git.git
14 years agoRemove anachronism from comment
Michael Haggerty [Thu, 4 Aug 2011 04:36:13 +0000 (06:36 +0200)]
Remove anachronism from comment

Setting attributes to arbitrary values ("attribute=value") is now
supported, so it is no longer necessary for this comment to justify
prohibiting '=' in an attribute name.

Signed-off-by: Michael Haggerty <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agodoc: Correct git_attr() calls in example code
Michael Haggerty [Thu, 4 Aug 2011 04:36:12 +0000 (06:36 +0200)]
doc: Correct git_attr() calls in example code

Commit 7fb0eaa2 (2010-01-17) changed git_attr() to take a string
instead of a string and a length.  Update the documentation
accordingly.

Signed-off-by: Michael Haggerty <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agodoc: Add a link from gitattributes(5) to git-check-attr(1)
Michael Haggerty [Thu, 4 Aug 2011 04:36:11 +0000 (06:36 +0200)]
doc: Add a link from gitattributes(5) to git-check-attr(1)

Signed-off-by: Michael Haggerty <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agodocs: put listed example commands in backticks
Jeff King [Thu, 4 Aug 2011 02:13:29 +0000 (20:13 -0600)]
docs: put listed example commands in backticks

Many examples of git command invocation are given in asciidoc listing
blocks, which makes them monospaced and avoids further interpretation of
special characters.  Some manpages make a list of examples, like:

  git foo::
    Run git foo.

  git foo -q::
    Use the "-q" option.

to quickly show many variants. However, they can sometimes be hard to
read, because they are shown in a proportional-width font (so, for
example, seeing the difference between "-- foo" and "--foo" can be
difficult).

This patch puts all such examples into backticks, which gives the
equivalent formatting to a listing block (i.e., monospaced and without
character interpretation).

As a bonus, this also fixes an example in the git-push manpage, in which
"git push origin :::" was accidentally considered a newly-indented list,
and not a list item with "git push origin :" in it.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agorevert: Introduce --reset to remove sequencer state
Ramkumar Ramachandra [Thu, 4 Aug 2011 10:39:11 +0000 (16:09 +0530)]
revert: Introduce --reset to remove sequencer state

To explicitly remove the sequencer state for a fresh cherry-pick or
revert invocation, introduce a new subcommand called "--reset" to
remove the sequencer state.

Take the opportunity to publicly expose the sequencer paths, and a
generic function called "remove_sequencer_state" that various git
programs can use to remove the sequencer state in a uniform manner;
"git reset" uses it later in this series.  Introducing this public API
is also in line with our long-term goal of eventually factoring out
functions from revert.c into a generic commit sequencer.

Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agorevert: Make pick_commits functionally act on a commit list
Ramkumar Ramachandra [Thu, 4 Aug 2011 10:39:10 +0000 (16:09 +0530)]
revert: Make pick_commits functionally act on a commit list

Apart from its central objective of calling into the picking
mechanism, pick_commits creates a sequencer directory, prepares a todo
list, and even acts upon the "--reset" subcommand.  This makes for a
bad API since the central worry of callers is to figure out whether or
not any conflicts were encountered during the cherry picking.  The
current API is like:

  if (pick_commits(opts) < 0)
     print "Something failed, we're not sure what"

So, change pick_commits so that it's only responsible for picking
commits in a loop and reporting any errors, leaving the rest to a new
function called pick_revisions.  Consequently, the API of pick_commits
becomes much clearer:

  act_on_subcommand(opts->subcommand);
  todo_list = prepare_todo_list();
  if (pick_commits(todo_list, opts) < 0)
     print "Error encountered while picking commits"

Now, callers can easily call-in to the cherry-picking machinery by
constructing an arbitrary todo list along with some options.

Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agorevert: Save command-line options for continuing operation
Ramkumar Ramachandra [Thu, 4 Aug 2011 10:39:09 +0000 (16:09 +0530)]
revert: Save command-line options for continuing operation

In the same spirit as ".git/sequencer/head" and ".git/sequencer/todo",
introduce ".git/sequencer/opts" to persist the replay_opts structure
for continuing after a conflict resolution.  Use the gitconfig format
for this file so that it looks like:

  [options]
  signoff = true
  record-origin = true
  mainline = 1
  strategy = recursive
  strategy-option = patience
  strategy-option = ours

Helped-by: Jonathan Nieder <redacted>
Helped-by: Christian Couder <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agorevert: Save data for continuing after conflict resolution
Ramkumar Ramachandra [Thu, 4 Aug 2011 10:39:08 +0000 (16:09 +0530)]
revert: Save data for continuing after conflict resolution

Ever since v1.7.2-rc1~4^2~7 (revert: allow cherry-picking more than
one commit, 2010-06-02), a single invocation of "git cherry-pick" or
"git revert" can perform picks of several individual commits.  To
implement features like "--continue" to continue the whole operation,
we will need to store some information about the state and the plan at
the beginning.  Introduce a ".git/sequencer/head" file to store this
state, and ".git/sequencer/todo" file to store the plan.  The head
file contains the SHA-1 of the HEAD before the start of the operation,
and the todo file contains an instruction sheet whose format is
inspired by the format of the "rebase -i" instruction sheet.  As a
result, a typical todo file looks like:

  pick 8537f0e submodule add: test failure when url is not configured
  pick 4d68932 submodule add: allow relative repository path
  pick f22a17e submodule add: clean up duplicated code
  pick 59a5775 make copy_ref globally available

Since SHA-1 hex is abbreviated using an find_unique_abbrev(), it is
unambiguous.  This does not guarantee that there will be no ambiguity
when more objects are added to the repository.

These two files alone are not enough to implement a "--continue" that
remembers the command-line options specified; later patches in the
series save them too.

These new files are unrelated to the existing .git/CHERRY_PICK_HEAD,
which will still be useful while committing after a conflict
resolution.

Inspired-by: Christian Couder <redacted>
Helped-by: Junio C Hamano <redacted>
Helped-by: Jonathan Nieder <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agorevert: Don't create invalid replay_opts in parse_args
Ramkumar Ramachandra [Thu, 4 Aug 2011 10:39:07 +0000 (16:09 +0530)]
revert: Don't create invalid replay_opts in parse_args

The "--ff" command-line option cannot be used with some other
command-line options.  However, parse_args still parses these
incompatible options into a replay_opts structure for use by the rest
of the program.  Although pick_commits, the current gatekeeper to the
cherry-pick machinery, checks the validity of the replay_opts
structure before before starting its operation, there will be multiple
entry points to the cherry-pick machinery in future.  To futureproof
the code and catch these errors in one place, make sure that an
invalid replay_opts structure is not created by parse_args in the
first place.  We still check the replay_opts structure for validity in
pick_commits, but this is an assert() now to emphasize that it's the
caller's responsibility to get it right.

Inspired-by: Christian Couder <redacted>
Mentored-by: Jonathan Nieder <redacted>
Helped-by: Junio C Hamano <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agorevert: Separate cmdline parsing from functional code
Ramkumar Ramachandra [Thu, 4 Aug 2011 10:39:06 +0000 (16:09 +0530)]
revert: Separate cmdline parsing from functional code

Currently, revert_or_cherry_pick sets up a default git config, parses
command-line arguments, before preparing to pick commits.  This makes
for a bad API as the central worry of callers is to assert whether or
not a conflict occured while cherry picking.  The current API is like:

  if (revert_or_cherry_pick(argc, argv, opts) < 0)
     print "Something failed, we're not sure what"

Simplify and rename revert_or_cherry_pick to pick_commits so that it
only has the responsibility of setting up the revision walker and
picking commits in a loop.  Transfer the remaining work to its
callers.  Now, the API is simplified as:

  if (parse_args(argc, argv, opts) < 0)
     print "Can't parse arguments"
  if (pick_commits(opts) < 0)
     print "Error encountered in picking machinery"

Later in the series, pick_commits will also serve as the starting
point for continuing a cherry-pick or revert.

Inspired-by: Christian Couder <redacted>
Helped-by: Jonathan Nieder <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agorevert: Introduce struct to keep command-line options
Ramkumar Ramachandra [Thu, 4 Aug 2011 10:39:05 +0000 (16:09 +0530)]
revert: Introduce struct to keep command-line options

The current code uses a set of file-scope static variables to tell the
cherry-pick/ revert machinery how to replay the changes, and
initializes them by parsing the command-line arguments.  In later
steps in this series, we would like to introduce an API function that
calls into this machinery directly and have a way to tell it what to
do.  Hence, introduce a structure to group these variables, so that
the API can take them as a single replay_options parameter.  The only
exception is the variable "me" -- remove it since it not an
independent option, and can be inferred from the action.

Unfortunately, this patch introduces a minor regression.  Parsing
strategy-option violates a C89 rule: Initializers cannot refer to
variables whose address is not known at compile time.  Currently, this
rule is violated by some other parts of Git as well, and it is
possible to get GCC to report these instances using the "-std=c89
-pedantic" option.

Inspired-by: Christian Couder <redacted>
Mentored-by: Jonathan Nieder <redacted>
Helped-by: Junio C Hamano <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agorevert: Eliminate global "commit" variable
Ramkumar Ramachandra [Thu, 4 Aug 2011 10:39:04 +0000 (16:09 +0530)]
revert: Eliminate global "commit" variable

Functions which act on commits currently rely on a file-scope static
variable to be set before they're called.  Consequently, the API and
corresponding callsites are ugly and unclear.  Remove this variable
and change their API to accept the commit to act on as additional
argument so that the callsites change from looking like

  commit = prepare_a_commit();
  act_on_commit();

to looking like

  commit = prepare_a_commit();
  act_on_commit(commit);

This change is also in line with our long-term goal of exposing some
of these functions through a public API.

Inspired-by: Christian Couder <redacted>
Helped-by: Junio C Hamano <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agorevert: Rename no_replay to record_origin
Ramkumar Ramachandra [Thu, 4 Aug 2011 10:39:03 +0000 (16:09 +0530)]
revert: Rename no_replay to record_origin

The "-x" command-line option is used to record the name of the
original commits being picked in the commit message.  The variable
corresponding to this option is named "no_replay" for historical
reasons; the name is especially confusing because the term "replay" is
used to describe what cherry-pick does (for example, in the
documentation of the "--mainline" option).  So, give the variable
corresponding to the "-x" command-line option a better name:
"record_origin".

Mentored-by: Jonathan Nieder <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agorevert: Don't check lone argument in get_encoding
Ramkumar Ramachandra [Thu, 4 Aug 2011 10:39:02 +0000 (16:09 +0530)]
revert: Don't check lone argument in get_encoding

The only place get_encoding uses the global "commit" variable is when
writing an error message explaining that its lone argument was NULL.
Since the function's only caller ensures that a NULL argument isn't
passed, we can remove this check with two beneficial consequences:

1. Since the function doesn't use the global "commit" variable any
   more, it won't need to change when we eliminate the global variable
   later in the series.
2. Translators no longer need to localize an error message that will
   never be shown.

Suggested-by: Junio C Hamano <redacted>
Mentored-by: Jonathan Nieder <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agorevert: Simplify and inline add_message_to_msg
Ramkumar Ramachandra [Thu, 4 Aug 2011 10:39:01 +0000 (16:09 +0530)]
revert: Simplify and inline add_message_to_msg

The add_message_to_msg function has some dead code, an unclear API,
only one callsite.  While it originally intended fill up an empty
commit message with the commit object name while picking, it really
doesn't do this -- a bug introduced in v1.5.1-rc1~65^2~2 (Make
git-revert & git-cherry-pick a builtin, 2007-03-01).  Today, tests in
t3505-cherry-pick-empty.sh indicate that not filling up an empty
commit message is the desired behavior.  Re-implement and inline the
function accordingly, with a beneficial side-effect: don't dereference
a NULL pointer when the commit doesn't have a delimeter after the
header.

Helped-by: Junio C Hamano <redacted>
Mentored-by: Jonathan Nieder <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoconfig: Introduce functions to write non-standard file
Ramkumar Ramachandra [Thu, 4 Aug 2011 10:39:00 +0000 (16:09 +0530)]
config: Introduce functions to write non-standard file

Introduce two new functions corresponding to "git_config_set" and
"git_config_set_multivar" to write a non-standard configuration file.
Expose these new functions in cache.h for other git programs to use.

Helped-by: Jeff King <redacted>
Helped-by: Jonathan Nieder <redacted>
Reviewed-by: Jonathan Nieder <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoadvice: Introduce error_resolve_conflict
Ramkumar Ramachandra [Thu, 4 Aug 2011 10:38:59 +0000 (16:08 +0530)]
advice: Introduce error_resolve_conflict

Enable future callers to report a conflict and not die immediately by
introducing a new function called error_resolve_conflict.
Re-implement die_resolve_conflict as a call to error_resolve_conflict
followed by a call to die.  Consequently, the message printed by
die_resolve_conflict changes from

  fatal: 'commit' is not possible because you have unmerged files.
         Please, fix them up in the work tree ...
         ...

to

  error: 'commit' is not possible because you have unmerged files.
  hint: Fix them up in the work tree ...
  hint: ...
  fatal: Exiting because of an unresolved conflict.

Hints are printed using the same advise function introduced in
v1.7.3-rc0~26^2~3 (Introduce advise() to print hints, 2010-08-11).

Inspired-by: Christian Couder <redacted>
Helped-by: Jonathan Nieder <redacted>
Reviewed-by: Jonathan Nieder <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agobisect: add documentation for --no-checkout option.
Jon Seymour [Thu, 4 Aug 2011 12:01:03 +0000 (22:01 +1000)]
bisect: add documentation for --no-checkout option.

Signed-off-by: Jon Seymour <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agobisect: add tests for the --no-checkout option.
Jon Seymour [Thu, 4 Aug 2011 12:01:02 +0000 (22:01 +1000)]
bisect: add tests for the --no-checkout option.

These tests verify that git-bisect --no-checkout can successfully
bisect commit histories that reference damaged trees.

Signed-off-by: Jon Seymour <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agobisect: introduce --no-checkout support into porcelain.
Jon Seymour [Thu, 4 Aug 2011 12:01:01 +0000 (22:01 +1000)]
bisect: introduce --no-checkout support into porcelain.

git-bisect can now perform bisection of a history without performing
a checkout at each stage of the bisection process. Instead, HEAD is updated.

One use-case for this function is allow git bisect to be used with
damaged repositories where git checkout would fail because the tree
referenced by the commit is damaged.

It can also be used in other cases where actual checkout of the tree
is not required to progress the bisection.

Improved-by: Christian Couder <redacted>
Improved-by: Junio C Hamano <redacted>
Improved-by: Jonathan Nieder <redacted>
Signed-off-by: Jon Seymour <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agobisect: introduce support for --no-checkout option.
Jon Seymour [Thu, 4 Aug 2011 12:01:00 +0000 (22:01 +1000)]
bisect: introduce support for --no-checkout option.

If --no-checkout is specified, then the bisection process uses:

git update-ref --no-deref HEAD <trial>

at each trial instead of:

git checkout <trial>

Improved-by: Christian Couder <redacted>
Signed-off-by: Jon Seymour <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agobisect: add tests to document expected behaviour in presence of broken trees.
Jon Seymour [Thu, 4 Aug 2011 12:00:59 +0000 (22:00 +1000)]
bisect: add tests to document expected behaviour in presence of broken trees.

If the repo is broken, we expect bisect to fail.

Signed-off-by: Jon Seymour <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agobisect: use && to connect statements that are deferred with eval.
Jon Seymour [Thu, 4 Aug 2011 12:00:58 +0000 (22:00 +1000)]
bisect: use && to connect statements that are deferred with eval.

Christian Couder pointed out that the existing eval strategy
swallows an initial non-zero return. Using && to connect
the statements should fix this.

Signed-off-by: Jon Seymour <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agobisect: move argument parsing before state modification.
Jon Seymour [Thu, 4 Aug 2011 12:00:57 +0000 (22:00 +1000)]
bisect: move argument parsing before state modification.

Currently 'git bisect start' modifies some state prior to checking
that its arguments are valid.

This change moves argument validation before state modification
with the effect that state modification does not occur
unless argument validations succeeds.

An existing test is changed to check that new bisect state
is not created if arguments are invalid.

A new test is added to check that existing bisect state
is not modified if arguments are invalid.

Signed-off-by: Jon Seymour <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agogitweb: pass string after encoding in utf-8 to syntax highlighter
张忠山 [Thu, 4 Aug 2011 15:52:55 +0000 (23:52 +0800)]
gitweb: pass string after encoding in utf-8 to syntax highlighter

Otherwise the highlight filter would work on a corrupt byte sequence.

Signed-off-by: 张忠山 <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoAdd option hooks.diffopts to customize change summary in post-receive-email
Jon Jensen [Thu, 4 Aug 2011 03:36:08 +0000 (21:36 -0600)]
Add option hooks.diffopts to customize change summary in post-receive-email

This makes it easy to customize the git diff-tree options, for example
to include -p to include inline diffs.

It defaults to the current options "--stat --summary --find-copies-harder"
and thus is backward-compatible.

Signed-off-by: Jon Jensen <redacted>
Improved-by: Junio C Hamano <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agodiff -c/--cc: do not mistake "resolved as deletion" as "use working tree"
Junio C Hamano [Thu, 4 Aug 2011 18:39:10 +0000 (11:39 -0700)]
diff -c/--cc: do not mistake "resolved as deletion" as "use working tree"

The combined diff machinery can be used to compare:

 - a merge commit with its parent commits;
 - a working-tree file with multiple stages in an unmerged index; or
 - a working-tree file with the HEAD and the index.

The internal function combine-diff.c:show_patch_diff() checked if it needs
to read the "result" from the working tree by looking at the object name
of the result --- if it is null_sha1, it read from the working tree.

This mistook a merge that records a deletion as the conflict resolution
as if it is a cue to read from the working tree. Pass this information
explicitly from the caller instead.

Noticed and reported by Johan Herland.

Signed-off-by: Junio C Hamano <redacted>
14 years agoMerge branch 'maint'
Junio C Hamano [Wed, 3 Aug 2011 21:16:17 +0000 (14:16 -0700)]
Merge branch 'maint'

* maint:
  add gitignore entry to description about how to write a builtin
  gitattributes: Reword "attribute macro" to "macro attribute"
  gitattributes: Clarify discussion of attribute macros

14 years agoadd gitignore entry to description about how to write a builtin
Heiko Voigt [Wed, 3 Aug 2011 18:06:17 +0000 (20:06 +0200)]
add gitignore entry to description about how to write a builtin

If the author forgets the gitignore entry the built result will show up
as new file in the git working directory.

Signed-off-by: Heiko Voigt <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoMakefile: some changes for http-related flag documentation
Tay Ray Chuan [Wed, 3 Aug 2011 12:07:57 +0000 (20:07 +0800)]
Makefile: some changes for http-related flag documentation

Rename git-http-pull to git-http-fetch. This was passed over in 215a7ad
(Big tool rename, Wed Sep 7 17:26:23 2005 -0700).

Also, distinguish between dumb and smart in flag docs, as the "warnings"
in NO_CURL and NO_EXPACT are no longer accurate given the introduction
of smart http(s).

Signed-off-by: Tay Ray Chuan <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agohttp.c: fix an invalid free()
Tay Ray Chuan [Wed, 3 Aug 2011 11:54:03 +0000 (19:54 +0800)]
http.c: fix an invalid free()

Remove a free() on the static buffer returned by sha1_file_name().

While we're at it, replace xmalloc() calls on the structs
http_(object|pack)_request with xcalloc() so that pointers in the
structs get initialized to NULL. That way, free()'s are safe - for
example, a free() on the url string member when aborting.

This fixes an invalid free().

Reported-by: Ævar Arnfjörð Bjarmason <redacted>
Helped-by: Jeff King peff@peff.net
Signed-off-by: Tay Ray Chuan <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoam: pass exclude down to apply
maximilian attems [Wed, 3 Aug 2011 09:37:29 +0000 (11:37 +0200)]
am: pass exclude down to apply

This allows to pass patches around from repositories,
where the other repository doesn't feature certain files.

In the special case this works for dash git sync to klibc dash:
 git am --directory="usr/dash" --exclude="usr/dash/configure.ac" \
        --exclude="usr/dash/ChangeLog" --exclude="usr/dash/dash.1" \
.. -i -s -k ../dash/000X-foo.patch

Signed-off-by: maximilian attems <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agogitattributes: Reword "attribute macro" to "macro attribute"
Michael Haggerty [Wed, 3 Aug 2011 13:41:30 +0000 (15:41 +0200)]
gitattributes: Reword "attribute macro" to "macro attribute"

The new wording makes it clearer that such a beast is an attribute in
addition to being a macro (as opposed to being only a macro that is
used for attributes).

Signed-off-by: Michael Haggerty <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agogitattributes: Clarify discussion of attribute macros
Michael Haggerty [Wed, 3 Aug 2011 13:41:29 +0000 (15:41 +0200)]
gitattributes: Clarify discussion of attribute macros

In particular, make it clear that attribute macros are themselves
recorded as attributes in addition to setting other attributes.

Signed-off-by: Michael Haggerty <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoSkip archive --remote tests on Windows
Johannes Sixt [Wed, 3 Aug 2011 08:20:08 +0000 (10:20 +0200)]
Skip archive --remote tests on Windows

These depend on a working git-upload-archive, which is broken on Windows,
because it depends on fork().

Signed-off-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoxdiff: do away with xdl_mmfile_next()
Tay Ray Chuan [Mon, 1 Aug 2011 04:20:07 +0000 (12:20 +0800)]
xdiff: do away with xdl_mmfile_next()

Given our simple mmfile structure, xdl_mmfile_next() calls are
redundant. Do away with calls to them.

Signed-off-by: Tay Ray Chuan <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoMake test number unique
Johannes Sixt [Wed, 3 Aug 2011 07:25:31 +0000 (09:25 +0200)]
Make test number unique

Signed-off-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agocommit: allow partial commits with relative paths
Clemens Buchacher [Sat, 30 Jul 2011 17:13:47 +0000 (19:13 +0200)]
commit: allow partial commits with relative paths

In order to do partial commits, git-commit overlays a tree on the
cache and checks pathspecs against the result. Currently, the
overlaying is done using "prefix" which prevents relative pathspecs
with ".." and absolute pathspec from matching when they refer to
files not under "prefix" and absent from the index, but still in
the tree (i.e.  files staged for removal).

The point of providing a prefix at all is performance optimization.
If we say there is no common prefix for the files of interest, then
we have to read the entire tree into the index.

But even if we cannot use the working directory as a prefix, we can
still figure out if there is a common prefix for all given paths,
and use that instead. The pathspec_prefix() routine from ls-files.c
does exactly that.

Any use of global variables is removed from pathspec_prefix() so
that it can be called from commit.c.

Reported-by: Reuben Thomas <redacted>
Analyzed-by: Michael J Gruber <redacted>
Signed-off-by: Clemens Buchacher <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agonotice error exit from pager
Clemens Buchacher [Mon, 1 Aug 2011 17:59:21 +0000 (19:59 +0200)]
notice error exit from pager

If the pager fails to run, git produces no output, e.g.:

 $ GIT_PAGER=not-a-command git log

The error reporting fails for two reasons:

 (1) start_command: There is a mechanism that detects errors during
     execvp introduced in 2b541bf8 (start_command: detect execvp
     failures early). The child writes one byte to a pipe only if
     execvp fails.  The parent waits for either EOF, when the
     successful execvp automatically closes the pipe (see
     FD_CLOEXEC in fcntl(1)), or it reads a single byte, in which
     case it knows that the execvp failed. This mechanism is
     incompatible with the workaround introduced in 35ce8622
     (pager: Work around window resizing bug in 'less'), which
     waits for input from the parent before the exec. Since both
     the parent and the child are waiting for input from each
     other, that would result in a deadlock. In order to avoid
     that, the mechanism is disabled by closing the child_notifier
     file descriptor.

 (2) finish_command: The parent correctly detects the 127 exit
     status from the child, but the error output goes nowhere,
     since by that time it is already being redirected to the
     child.

No simple solution for (1) comes to mind.

Number (2) can be solved by not sending error output to the pager.
Not redirecting error output to the pager can result in the pager
overwriting error output with standard output, however.

Since there is no reliable way to handle error reporting in the
parent, produce the output in the child instead.

Signed-off-by: Clemens Buchacher <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agogrep: long context options
René Scharfe [Mon, 1 Aug 2011 17:22:52 +0000 (19:22 +0200)]
grep: long context options

Take long option names for -A (--after-context), -B (--before-context)
and -C (--context) from GNU grep and add a similar long option name
for -W (--function-context).

Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agogrep: add option to show whole function as context
René Scharfe [Mon, 1 Aug 2011 17:20:53 +0000 (19:20 +0200)]
grep: add option to show whole function as context

Add a new option, -W, to show the whole surrounding function of a match.

It uses the same regular expressions as -p and diff to find the beginning
of sections.

Currently it will not display comments in front of a function, but those
that are following one.  Despite this shortcoming it is already useful,
e.g. to simply see a more complete applicable context or to extract whole
functions.

Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agopull: remove extra space from reflog message
Ori Avtalion [Fri, 29 Jul 2011 07:19:26 +0000 (10:19 +0300)]
pull: remove extra space from reflog message

When executing "git pull" with no arguments, the reflog message was:
  "pull : Fast-forward"

Signed-off-by: Ori Avtalion <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoDocumentation/submodule: add command references and update options
Jens Lehmann [Mon, 1 Aug 2011 20:49:21 +0000 (22:49 +0200)]
Documentation/submodule: add command references and update options

Reference the "git diff" and "git status" commands where they learned
functionality that in earlier git versions was only available through the
'summary' and 'status' subcommands of "git submodule".

The short option '-n' for '--summary-limit' was missing from the synopsis
and the --init option was missing from the "options" section, add those
there. And while at it, quote all options in backticks so they are
decorated properly in the output formats which support that.

Signed-off-by: Jens Lehmann <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoMerge branch 'vi/make-test-vector-less-specific'
Junio C Hamano [Mon, 1 Aug 2011 22:00:38 +0000 (15:00 -0700)]
Merge branch 'vi/make-test-vector-less-specific'

* vi/make-test-vector-less-specific:
  tests: cleanup binary test vector files

14 years agoMerge branch 'jk/clone-detached'
Junio C Hamano [Mon, 1 Aug 2011 22:00:35 +0000 (15:00 -0700)]
Merge branch 'jk/clone-detached'

* jk/clone-detached:
  clone: always fetch remote HEAD
  make copy_ref globally available
  consider only branches in guess_remote_head
  t: add tests for cloning remotes with detached HEAD

14 years agoMerge branch 'jc/streaming-filter'
Junio C Hamano [Mon, 1 Aug 2011 22:00:29 +0000 (15:00 -0700)]
Merge branch 'jc/streaming-filter'

* jc/streaming-filter:
  streaming: free git_istream upon closing

14 years agoMerge branch 'sr/transport-helper-fix'
Junio C Hamano [Mon, 1 Aug 2011 22:00:14 +0000 (15:00 -0700)]
Merge branch 'sr/transport-helper-fix'

* sr/transport-helper-fix: (21 commits)
  transport-helper: die early on encountering deleted refs
  transport-helper: implement marks location as capability
  transport-helper: Use capname for refspec capability too
  transport-helper: change import semantics
  transport-helper: update ref status after push with export
  transport-helper: use the new done feature where possible
  transport-helper: check status code of finish_command
  transport-helper: factor out push_update_refs_status
  fast-export: support done feature
  fast-import: introduce 'done' command
  git-remote-testgit: fix error handling
  git-remote-testgit: only push for non-local repositories
  remote-curl: accept empty line as terminator
  remote-helpers: export GIT_DIR variable to helpers
  git_remote_helpers: push all refs during a non-local export
  transport-helper: don't feed bogus refs to export push
  git-remote-testgit: import non-HEAD refs
  t5800: document some non-functional parts of remote helpers
  t5800: use skip_all instead of prereq
  t5800: factor out some ref tests
  ...

14 years agoMerge branch 'jc/maint-reset-unmerged-path'
Junio C Hamano [Mon, 1 Aug 2011 22:00:08 +0000 (15:00 -0700)]
Merge branch 'jc/maint-reset-unmerged-path'

* jc/maint-reset-unmerged-path:
  reset [<commit>] paths...: do not mishandle unmerged paths

14 years agoMerge branch 'maint'
Junio C Hamano [Mon, 1 Aug 2011 21:45:02 +0000 (14:45 -0700)]
Merge branch 'maint'

* maint:
  connect: correctly number ipv6 network adapter

14 years agoMerge branch 'nk/ref-doc' into maint
Junio C Hamano [Mon, 1 Aug 2011 21:44:24 +0000 (14:44 -0700)]
Merge branch 'nk/ref-doc' into maint

* nk/ref-doc:
  glossary: clarify description of HEAD
  glossary: update description of head and ref
  glossary: update description of "tag"
  git.txt: de-emphasize the implementation detail of a ref
  check-ref-format doc: de-emphasize the implementation detail of a ref
  git-remote.txt: avoid sounding as if loose refs are the only ones in the world
  git-remote.txt: fix wrong remote refspec

14 years agoMerge branch 'jl/maint-fetch-recursive-fix' into maint
Junio C Hamano [Mon, 1 Aug 2011 21:44:17 +0000 (14:44 -0700)]
Merge branch 'jl/maint-fetch-recursive-fix' into maint

* jl/maint-fetch-recursive-fix:
  fetch: Also fetch submodules in subdirectories in on-demand mode

14 years agoMerge branch 'jc/maint-cygwin-trust-executable-bit-default' into maint
Junio C Hamano [Mon, 1 Aug 2011 21:44:13 +0000 (14:44 -0700)]
Merge branch 'jc/maint-cygwin-trust-executable-bit-default' into maint

* jc/maint-cygwin-trust-executable-bit-default:
  cygwin: trust executable bit by default

14 years agoMerge branch 'jc/legacy-loose-object' into maint
Junio C Hamano [Mon, 1 Aug 2011 21:43:58 +0000 (14:43 -0700)]
Merge branch 'jc/legacy-loose-object' into maint

* jc/legacy-loose-object:
  sha1_file.c: "legacy" is really the current format

14 years agoMerge branch 'an/shallow-doc' into maint
Junio C Hamano [Mon, 1 Aug 2011 21:43:53 +0000 (14:43 -0700)]
Merge branch 'an/shallow-doc' into maint

* an/shallow-doc:
  Document the underlying protocol used by shallow repositories and --depth commands.
  Fix documentation of fetch-pack that implies that the client can disconnect after sending wants.

14 years agoMerge branch 'jc/maint-1.7.3-checkout-describe' into maint
Junio C Hamano [Mon, 1 Aug 2011 21:43:18 +0000 (14:43 -0700)]
Merge branch 'jc/maint-1.7.3-checkout-describe' into maint

* jc/maint-1.7.3-checkout-describe:
  checkout -b <name>: correctly detect existing branch

14 years agoreflog: actually default to subcommand 'show'
Michael Schubert [Mon, 1 Aug 2011 11:20:42 +0000 (13:20 +0200)]
reflog: actually default to subcommand 'show'

The reflog manpage says:

git reflog [show] [log-options] [<ref>]

the subcommand 'show' is the default "in the absence of any
subcommands". Currently this is only true if the user provided either
at least one option or no additional argument at all. For example:

git reflog master

won't work. Change this by actually calling cmd_log_reflog in
absence of any subcommand.

Signed-off-by: Michael Schubert <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoconnect: only log if all attempts failed (ipv4)
Erik Faye-Lund [Mon, 1 Aug 2011 11:16:10 +0000 (13:16 +0200)]
connect: only log if all attempts failed (ipv4)

In 63a995b (Do not log unless all connect() attempts fail), a
mechanism to only log connection errors if all attempts failed
was introduced for the IPv6 code-path, but not for the IPv4 one.

Introduce a matching mechanism so IPv4-users also benefit from
this noise-reduction.

Move the call to socket after filling in sa, to make it more
apparent that errno can't change in between.

Signed-off-by: Erik Faye-Lund <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoMerge branch 'maint' into ef/ipv4-connect-error-report
Junio C Hamano [Mon, 1 Aug 2011 17:49:40 +0000 (10:49 -0700)]
Merge branch 'maint' into ef/ipv4-connect-error-report

* maint:
  connect: correctly number ipv6 network adapter

14 years agoconnect: correctly number ipv6 network adapter
Erik Faye-Lund [Mon, 1 Aug 2011 11:16:09 +0000 (13:16 +0200)]
connect: correctly number ipv6 network adapter

In ba50532, the variable 'cnt' was added to both the IPv6 and the
IPv4 version of git_tcp_connect_sock, intended to identify which
network adapter the connection failed on. But in the IPv6 version,
the variable was never increased, leaving it constantly at zero.

This behaviour isn't very useful, so let's fix it by increasing
the variable at every loop-iteration.

Signed-off-by: Erik Faye-Lund <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agogit-p4: commit time should be most recent p4 change time
Pete Wyckoff [Sun, 31 Jul 2011 13:45:55 +0000 (09:45 -0400)]
git-p4: commit time should be most recent p4 change time

When importing a repo, the time on the initial commit had been
just "now".  But this causes problems when trying to share among
git-p4 repos that were created identically, although at different
times.  Instead, use the time in the top-most p4 change as the
time for the git import commit.

Signed-off-by: Pete Wyckoff <redacted>
Acked-by: Luke Diamand <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agogit-p4: one test missing config git-p4.skipSubmitEditCheck
Pete Wyckoff [Sun, 31 Jul 2011 13:45:38 +0000 (09:45 -0400)]
git-p4: one test missing config git-p4.skipSubmitEditCheck

Add this missing line in one of the tests.  Otherwise, on fast
machines, the following git-p4 commit will complain that nobody
edited the submission message.

Signed-off-by: Pete Wyckoff <redacted>
Acked-by: Luke Diamand <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agogit-p4: add missing && in test
Pete Wyckoff [Sun, 31 Jul 2011 13:45:17 +0000 (09:45 -0400)]
git-p4: add missing && in test

Signed-off-by: Pete Wyckoff <redacted>
Acked-by: Luke Diamand <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agogit-p4: use test_when_finished in tests
Pete Wyckoff [Sun, 31 Jul 2011 13:44:50 +0000 (09:44 -0400)]
git-p4: use test_when_finished in tests

Cleanup nicely when tests fail.  This avoids many duplicated
lines in the tests, and adds cleanup in a couple of tests that
did not have it.  When one fails, now all the rest will not
fail too.

Signed-off-by: Pete Wyckoff <redacted>
Acked-by: Luke Diamand <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoMerge branch 'maint'
Junio C Hamano [Mon, 1 Aug 2011 01:57:32 +0000 (18:57 -0700)]
Merge branch 'maint'

* maint:
  Break down no-lstat() condition checks in verify_uptodate()
  t7400: fix bogus test failure with symlinked trash
  Documentation: clarify the invalidated tree entry format

14 years agopropagate --quiet to send-pack/receive-pack
Clemens Buchacher [Sat, 30 Jul 2011 12:10:14 +0000 (14:10 +0200)]
propagate --quiet to send-pack/receive-pack

Currently, git push --quiet produces some non-error output, e.g.:

 $ git push --quiet
 Unpacking objects: 100% (3/3), done.

Add the --quiet option to send-pack/receive-pack and pass it to
unpack-objects in the receive-pack codepath and to receive-pack in
the push codepath.

This fixes a bug reported for the fedora git package:

 https://bugzilla.redhat.com/show_bug.cgi?id=725593

Reported-by: Jesse Keating <redacted>
Cc: Todd Zullinger <redacted>
Signed-off-by: Clemens Buchacher <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoBreak down no-lstat() condition checks in verify_uptodate()
Nguyễn Thái Ngọc Duy [Sat, 30 Jul 2011 03:55:05 +0000 (10:55 +0700)]
Break down no-lstat() condition checks in verify_uptodate()

Make it easier to grok under what conditions we can skip lstat().

While at there, shorten ie_match_stat() line for the sake of my eyes.

Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agot7400: fix bogus test failure with symlinked trash
Jeff King [Sat, 30 Jul 2011 15:05:54 +0000 (09:05 -0600)]
t7400: fix bogus test failure with symlinked trash

One of the tests in t7400 fails if the trash directory has a
symlink anywhere in its path. E.g.:

  $ mkdir /tmp/git-test
  $ mkdir /tmp/git-test/real
  $ ln -s real /tmp/git-test/link

  $ ./t7400-submodule-basic --root=/tmp/git-test/real
  ...
  # passed all 44 test(s)

  $ ./t7400-submodule-basic --root=/tmp/git-test/link
  ...
  not ok - 41 use superproject as upstream when path is relative and no url is set there

The failing test does:

  git submodule add ../repo relative &&
  ...
  git submodule sync relative &&
  test "$(git config submodule.relative.url)" = "$submodurl/repo"

where $submodurl comes from the $TRASH_DIRECTORY the user
gave us. However, git will resolve symlinks when converting
the relative path into an absolute one, leading them to be
textually different (even though they point to the same
directory).

Fix this by asking pwd to canonicalize the name of the trash
directory for us.

Signed-off-by: Jeff King <redacted>
Acked-by: Jens Lehmann <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agogitweb: Git config keys are case insensitive, make config search too
Jakub Narebski [Thu, 28 Jul 2011 21:38:03 +0000 (23:38 +0200)]
gitweb: Git config keys are case insensitive, make config search too

"git config -z -l" that gitweb uses in git_parse_project_config() to
populate %config hash returns section and key names of config
variables in lowercase (they are case insensitive).  When checking
%config in git_get_project_config() we have to take it into account.

Helped-by: Junio C Hamano <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoerror_routine: use parent's stderr if exec fails
Clemens Buchacher [Wed, 27 Jul 2011 21:32:34 +0000 (23:32 +0200)]
error_routine: use parent's stderr if exec fails

The new process's error output may be redirected elsewhere, but if
the exec fails, output should still go to the parent's stderr. This
has already been done for the die_routine. Do the same for
error_routine.

Signed-off-by: Clemens Buchacher <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoDocumentation: clarify the invalidated tree entry format
Carlos Martín Nieto [Tue, 26 Jul 2011 12:27:57 +0000 (14:27 +0200)]
Documentation: clarify the invalidated tree entry format

When the entry_count is -1, the tree is invalidated and therefore has
not associated hash (or object name). Explicitly state that the next
entry starts after the newline.

Signed-off-by: Carlos Martín Nieto <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agosubmodule: update and add must honor --quiet flag
Jens Lehmann [Tue, 26 Jul 2011 21:39:03 +0000 (23:39 +0200)]
submodule: update and add must honor --quiet flag

When using the --quiet flag "git submodule update" and "git submodule add"
didn't behave as the documentation stated. They printed progress output
from the clone, even though they should only print error messages.

Fix that by passing the -q flag to git clone in module_clone() when the
GIT_QUIET variable is set. Two tests in t7400 have been modified to test
that behavior.

Reported-by: Daniel Holtmann-Rice <redacted>
Signed-off-by: Jens Lehmann <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoEnsure git ls-tree exits with a non-zero exit code if read_tree_recursive fails.
Jon Seymour [Sun, 24 Jul 2011 14:59:14 +0000 (00:59 +1000)]
Ensure git ls-tree exits with a non-zero exit code if read_tree_recursive fails.

In the case of a corrupt repository, git ls-tree may report an error but
presently it exits with a code of 0.

This change uses the return code of read_tree_recursive instead.

Improved-by: Jens Lehmann <redacted>
Signed-off-by: Jon Seymour <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoMerge branch 'maint'
Junio C Hamano [Sun, 24 Jul 2011 23:23:01 +0000 (16:23 -0700)]
Merge branch 'maint'

* maint:
  tests: print failed test numbers at the end of the test run

14 years agogitweb: Introduce common system-wide settings for convenience
Jakub Narebski [Sun, 24 Jul 2011 22:29:18 +0000 (00:29 +0200)]
gitweb: Introduce common system-wide settings for convenience

Because of backward compatibility we cannot change gitweb to always
use /etc/gitweb.conf (i.e. even if gitweb_config.perl exists).  For
common system-wide settings we therefore need separate configuration
file: /etc/gitweb-common.conf.

Long description:

gitweb currently obtains configuration from the following sources:

  1. per-instance configuration file (default: gitweb_conf.perl)
  2. system-wide configuration file (default: /etc/gitweb.conf)

If per-instance configuration file exists, then system-wide
configuration is _not used at all_.  This is quite untypical and
suprising behavior.

Moreover it is different from way git itself treats /etc/git.conf.  It
reads in stuff from /etc/git.conf and then local repos can change or
override things as needed.  In fact this is quite beneficial, because
it gives site admins a simple and easy way to give an automatic hint
to a repo about things the admin would like.

On the other hand changing current behavior may lead to the situation,
where something in /etc/gitweb.conf may interfere with unintended
interaction in the local repository.  One solution would be to
_require_ to do explicit include; with read_config_file() it is now
easy, as described in gitweb/README (description introduced in this
commit).

But as J.H. noticed we cannot ask people to modify their per-instance
gitweb config file to include system-wide settings, nor we can require
them to do this.

Therefore, as proposed by Junio, for gitweb to have centralized config
elements while retaining backwards compatibility, introduce separate
common system-wide configuration file, by default /etc/gitweb-common.conf

Noticed-by: Drew Northup <redacted>
Helped-by: John 'Warthog9' Hawley <redacted>
Inspired-by: Junio C Hamano <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agotests: print failed test numbers at the end of the test run
Jens Lehmann [Sun, 24 Jul 2011 13:35:54 +0000 (15:35 +0200)]
tests: print failed test numbers at the end of the test run

On modern multi-core processors "make test" is often run in multiple jobs.
If one of them fails the test run does stop, but the concurrently running
tests finish their run. It is rather easy to find out which test failed by
doing a "ls -d t/trash*". But that only works when you don't use the "-i"
option to "make test" because you want to get an overview of all failing
tests. In that case all thrash directories are deleted end and the
information which tests failed is lost.

If one or more tests failed, print a list of them before the test summary:

failed test(s): t1000 t6500

fixed   0
success 7638
failed  3
broken  49
total   7723

This makes it possible to just run the test suite with -i and collect all
failed test scripts at the end for further examination.

Signed-off-by: Jens Lehmann <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoAdd a test to check that git ls-tree sets non-zero exit code on error.
Jon Seymour [Sun, 24 Jul 2011 14:59:13 +0000 (00:59 +1000)]
Add a test to check that git ls-tree sets non-zero exit code on error.

Expected to fail at this commit, fixed by subsequent commit.

Additional tests of adhoc or uncategorised nature should be added to this
file.

Improved-by: Jens Lehmann <redacted>
Improved-by: Junio C Hamano <redacted>
Signed-off-by: Jon Seymour <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agogitk: Make "touching paths" search support backslashes
Yggy King [Wed, 13 Jul 2011 08:30:26 +0000 (01:30 -0700)]
gitk: Make "touching paths" search support backslashes

Gitk can search for commits touching a specified path. The search text is
always treated as a regular expression, regardless of the matching option
selected (Exact, IgnCase, or Regexp). In particular, backslashes escape
the next character. This is inconvenient on Windows systems, where backslashes
are the norm for path specifiers, for example when copy/pasting from
Windows Explorer or a cmd shell -- these copy-pasted paths must be manually
modified in the gitk search text edit box before they will work.

This change uses the match option "Exact" to mean that a slash is a slash,
not part of a regular expression. Backslashes are converted to frontslashes
before searching, thus allowing easy copy/pasting of paths on Windows
systems. If the previous behaviour of "touching paths" search is desired,
simply select the "Regexp" search mode.

One potential drawback is that the default setting for the match option
($findtype in the code) is "Exact", and so this change alters the default
behaviour, which may confuse users and lead to bug reports.

Signed-off-by: Yggy King <redacted>
Signed-off-by: Paul Mackerras <redacted>
14 years agogitk: Show modified files with separate work tree
Martin von Zweigbergk [Tue, 24 May 2011 02:44:08 +0000 (22:44 -0400)]
gitk: Show modified files with separate work tree

"git rev-parse --is-inside-work-tree" is currently used to determine
whether to show modified files in gitk (the red and green fake
commits). This does not work if the current directory is not inside
the work tree, as can be the case e.g. if GIT_WORK_TREE is
set. Instead, check if the repository is not bare and that we are not
inside the .git directory.

Signed-off-by: Martin von Zweigbergk <redacted>
Signed-off-by: Paul Mackerras <redacted>
14 years agogitk: Simplify calculation of gitdir
Martin von Zweigbergk [Tue, 5 Apr 2011 02:14:18 +0000 (22:14 -0400)]
gitk: Simplify calculation of gitdir

Since 5024baa ([PATCH] Make gitk work when launched in a subdirectory,
2007-01-09), gitk has used 'git rev-parse --git-dir' to find the .git
directory. However, gitk still first checks for the $GIT_DIR
environment variable and that the value returned from git-rev-parse
does not point to a file. Since git-rev-parse does both of these
checks already, the checks can safely be removed from gitk. This makes
the gitdir procedure small enough to inline.

This cleanup introduces a UI regression in that the error message will
now be "Cannot find a git repository here." even in the case where
GIT_DIR points to a file, for which the error message was previously
"Cannot find the git directory \"%s\".". It should be noted, though,
that even before this patch, 'gitk --git-dir=path/to/some/file' would
give the former error message.

Signed-off-by: Martin von Zweigbergk <redacted>
Signed-off-by: Paul Mackerras <redacted>
14 years agogitk: Run 'git rev-parse --git-dir' only once
Martin von Zweigbergk [Tue, 5 Apr 2011 02:14:17 +0000 (22:14 -0400)]
gitk: Run 'git rev-parse --git-dir' only once

It seems like gitk has been setting the global variable 'gitdir' at
startup since aa81d97 (gitk: Fix Update menu item, 2006-02-28).  It
should therefore no longer be necessary to call the procedure with the
same name (more than once to set the global variable).  Remove the
other call sites and use the global variable instead.

Signed-off-by: Martin von Zweigbergk <redacted>
Signed-off-by: Paul Mackerras <redacted>
14 years agogitk: Put temporary directory inside .git
Martin von Zweigbergk [Tue, 5 Apr 2011 02:14:16 +0000 (22:14 -0400)]
gitk: Put temporary directory inside .git

When running "External diff" from gitk, the "from" and "to" files will
first be copied into a directory that is currently
".git/../.gitk-tmp.$pid".  When gitk is closed, the directory is
deleted. When the work tree is not at ".git/.." (which is supported
since the previous commit), that directory may not even be git-related
and it does not seem unlikely that permissions may not allow the
temporary directory to be created there.  Move the directory inside
.git instead.

This introduces a regression in the case that the .git directory
is readonly, but .git/.. is writeable.

Signed-off-by: Martin von Zweigbergk <redacted>
Signed-off-by: Paul Mackerras <redacted>
14 years agogitk: Fix "External diff" with separate work tree
Martin von Zweigbergk [Tue, 5 Apr 2011 02:14:15 +0000 (22:14 -0400)]
gitk: Fix "External diff" with separate work tree

Running "External diff" to compare the index and work tree currently
brings up an empty blame view when the work tree is not the parent of
the git directory.  This is because the file that is taken from the
work tree is assumed to be in
$GIT_DIR/../<repo-relative-file-name>.  Fix it by feeding the diff tool
a path under $GIT_WORK_TREE instead of "$GIT_DIR/..".

Signed-off-by: Martin von Zweigbergk <redacted>
Signed-off-by: Paul Mackerras <redacted>
14 years agogitk: Fix "blame parent commit" with separate work tree
Martin von Zweigbergk [Tue, 5 Apr 2011 02:14:14 +0000 (22:14 -0400)]
gitk: Fix "blame parent commit" with separate work tree

Running "blame parent commit" currently brings up an empty blame view
when the the work tree is not the parent of the git directory.  Fix it
by feeding git-blame paths relative to $GIT_WORK_TREE instead of
"$GIT_DIR/..".

Signed-off-by: Martin von Zweigbergk <redacted>
Signed-off-by: Paul Mackerras <redacted>
14 years agogitk: Fix "show origin of this line" with separate work tree
Martin von Zweigbergk [Tue, 5 Apr 2011 02:14:13 +0000 (22:14 -0400)]
gitk: Fix "show origin of this line" with separate work tree

Running "show origin of this line" currently fails when the the work
tree is not the parent of the git directory.  Fix it by feeding
git-blame paths relative to $GIT_WORK_TREE instead of "$GIT_DIR/..".

Signed-off-by: Martin von Zweigbergk <redacted>
Signed-off-by: Paul Mackerras <redacted>
14 years agogitk: Fix file highlight when run in subdirectory
Martin von Zweigbergk [Tue, 5 Apr 2011 02:14:12 +0000 (22:14 -0400)]
gitk: Fix file highlight when run in subdirectory

The "highlight this only" and "highlight this too" commands in gitk
add the path relative to $GIT_WORK_TREE to the "Find" input box. When
the search (using git-diff-tree) is run, the paths are used
unmodified, except for some shell escaping. Since the search is run
from gitk's working directory, no commits matching the paths will be
found if gitk was started in a subdirectory.

Make the paths passed to git-diff-tree relative to gitk's working
directory instead of being relative to $GIT_WORK_TREE. If, however,
gitk is run outside of the working directory (e.g. with $GIT_WORK_TREE
set), we still need to use the path relative to $GIT_WORK_TREE.

Signed-off-by: Martin von Zweigbergk <redacted>
Signed-off-by: Paul Mackerras <redacted>
14 years agogitk: Update copyright
Paul Mackerras [Sun, 24 Jul 2011 05:34:48 +0000 (15:34 +1000)]
gitk: Update copyright

Signed-off-by: Paul Mackerras <redacted>
14 years agoUpdate draft release notes to 1.7.7
Junio C Hamano [Fri, 22 Jul 2011 22:32:03 +0000 (15:32 -0700)]
Update draft release notes to 1.7.7

The third batch.

Signed-off-by: Junio C Hamano <redacted>
14 years agoMerge branch 'dc/stash-con-untracked'
Junio C Hamano [Fri, 22 Jul 2011 21:46:28 +0000 (14:46 -0700)]
Merge branch 'dc/stash-con-untracked'

* dc/stash-con-untracked:
  stash: Add --include-untracked option to stash and remove all untracked files

Conflicts:
git-stash.sh

14 years agoMerge branch 'jk/tag-contains-ab'
Junio C Hamano [Fri, 22 Jul 2011 21:45:19 +0000 (14:45 -0700)]
Merge branch 'jk/tag-contains-ab'

* jk/tag-contains-ab:
  Revert clock-skew based attempt to optimize tag --contains traversal
  git skew: a tool to find how big a clock skew exists in the history
  default core.clockskew variable to one day
  limit "contains" traversals based on commit timestamp
  tag: speed up --contains calculation

14 years agoMerge branch 'dz/connect-error-report'
Junio C Hamano [Fri, 22 Jul 2011 21:44:28 +0000 (14:44 -0700)]
Merge branch 'dz/connect-error-report'

* dz/connect-error-report:
  Do not log unless all connect() attempts fail

14 years agoMerge branch 'mz/doc-rebase-abort'
Junio C Hamano [Fri, 22 Jul 2011 21:44:08 +0000 (14:44 -0700)]
Merge branch 'mz/doc-rebase-abort'

* mz/doc-rebase-abort:
  rebase: clarify "restore the original branch"

14 years agoMerge branch 'bw/log-all-ref-updates-doc'
Junio C Hamano [Fri, 22 Jul 2011 21:43:51 +0000 (14:43 -0700)]
Merge branch 'bw/log-all-ref-updates-doc'

* bw/log-all-ref-updates-doc:
  Documentation: clearly specify what refs are honored by core.logAllRefUpdates

14 years agoMerge branch 'js/maint-add-path-stat-pwd'
Junio C Hamano [Fri, 22 Jul 2011 21:43:36 +0000 (14:43 -0700)]
Merge branch 'js/maint-add-path-stat-pwd'

* js/maint-add-path-stat-pwd:
  get_pwd_cwd(): Do not trust st_dev/st_ino blindly

14 years agoMerge branch 'ms/help-unknown'
Junio C Hamano [Fri, 22 Jul 2011 21:43:21 +0000 (14:43 -0700)]
Merge branch 'ms/help-unknown'

* ms/help-unknown:
  help_unknown_cmd: do not propose an "unknown" cmd

14 years agoMerge branch 'mz/doc-synopsis-verse'
Junio C Hamano [Fri, 22 Jul 2011 21:43:13 +0000 (14:43 -0700)]
Merge branch 'mz/doc-synopsis-verse'

* mz/doc-synopsis-verse:
  Documentation: use [verse] for SYNOPSIS sections

Conflicts:
Documentation/git-mergetool--lib.txt

14 years agoMerge branch 'jc/checkout-reflog-fix'
Junio C Hamano [Fri, 22 Jul 2011 21:43:03 +0000 (14:43 -0700)]
Merge branch 'jc/checkout-reflog-fix'

* jc/checkout-reflog-fix:
  checkout: do not write bogus reflog entry out

14 years agoMerge branch 'jc/maint-mergetool-read-fix'
Junio C Hamano [Fri, 22 Jul 2011 21:42:38 +0000 (14:42 -0700)]
Merge branch 'jc/maint-mergetool-read-fix'

* jc/maint-mergetool-read-fix:
  mergetool: check return value from read

14 years agostreaming: free git_istream upon closing
Jeff King [Fri, 22 Jul 2011 17:00:03 +0000 (11:00 -0600)]
streaming: free git_istream upon closing

Kirill Smelkov noticed that post-1.7.6 "git checkout"
started leaking tons of memory. The streaming_write_entry
function properly calls close_istream(), but that function
did not actually free() the allocated git_istream struct.

The git_istream struct is totally opaque to calling code,
and must be heap-allocated by open_istream. Therefore it's
not appropriate for callers to have to free it.

This patch makes close_istream() into "close and de-allocate
all associated resources". We could add a new "free_istream"
call, but there's not much point in letting callers inspect
the istream after close. And this patch's semantics make us
match fopen/fclose, which is well-known and understood.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
14 years agoMerge branch 'jn/gitweb-search'
Junio C Hamano [Fri, 22 Jul 2011 21:25:19 +0000 (14:25 -0700)]
Merge branch 'jn/gitweb-search'

* jn/gitweb-search:
  gitweb: Make git_search_* subroutines render whole pages
  gitweb: Clean up code in git_search_* subroutines
  gitweb: Split body of git_search into subroutines
  gitweb: Check permissions first in git_search

14 years agoMerge branch 'jl/submodule-add-relurl-wo-upstream'
Junio C Hamano [Fri, 22 Jul 2011 21:24:35 +0000 (14:24 -0700)]
Merge branch 'jl/submodule-add-relurl-wo-upstream'

* jl/submodule-add-relurl-wo-upstream:
  submodule add: clean up duplicated code
  submodule add: allow relative repository path even when no url is set
  submodule add: test failure when url is not configured in superproject

Conflicts:
git-submodule.sh

git clone https://git.99rst.org/PROJECT