gitweb.git
gitk: Fix possible infinite loop and display corruptionPaul Mackerras Sun, 1 Mar 2009 22:38:17 +0000 (09:38 +1100)

gitk: Fix possible infinite loop and display corruption

This fixes an issue reported by Johannes Sixt on the git mailing list:

> This recipe sends gitk into an endless loop. In git.git do:
>
> cd t
> # remove chmod a+x A near the end of the file
> sed -i 's/chmod/: chmod/' t3400-rebase.sh
> sh t3400-rebase.sh --debug
> cd trash\ directory.t3400-rebase/
> gitk master modechange modechange@{1}
>
>
> I briefly see the history chart, but the dot that should be modechange@{1}
> is missing. One automatically selected commit is shown in the diff section
> below. But then the commit list is cleared and gitk goes into an infinite
> loop.
>
> Things work alright if either modechange@{1} is dropped, or the 'chmod'
> line is left unchanged, which is a bit strange.
>
> This is with git version 1.6.1.2.390.gba743

There were actually two problems. This recipe created a situation where
git log would output a child commit after its parent. This meant that
we called fix_reversal which called splitvarc, which should call modify_arc
to note the fact that it has modified the arc that it has just split. It
wasn't, which meant that displayorder and other variables got into an
inconsistent state (a commit appearing twice in displayorder).

This then meant that the targetrow/targetid logic in drawvisible thought
it need to redraw each time. That, together with the fact that drawvisible
called drawcommits which called drawvisible if a redraw was needed, led
to the infinite loop.

In fact drawvisible is now the only caller of drawcommits. Thus, the
start and end row arguments to drawcommits always encompass the whole
visible area, so drawcommits doesn't need to call drawvisible to redraw;
it just needs to clear the screen and draw what it's been asked to.

This fixes these two problems by adding a call to modify_arc in
splitvarc and by taking out the call to drawvisible in drawcommits.
It also removes an unrelated left-over debugging puts in external_blame.

Signed-off-by: Paul Mackerras <paulus@samba.org>

Merge branch 'jc/maint-1.6.0-pack-directory'Junio C Hamano Sun, 1 Mar 2009 00:31:02 +0000 (16:31 -0800)

Merge branch 'jc/maint-1.6.0-pack-directory'

* jc/maint-1.6.0-pack-directory:
Fix odb_mkstemp() on AIX

Merge branch 'maint'Junio C Hamano Sat, 28 Feb 2009 22:39:56 +0000 (14:39 -0800)

Merge branch 'maint'

* maint:
Documentation: minor grammatical fixes.
added missing backtick in git-apply.txt

Documentation: minor grammatical fixes.David J. Mellor Sat, 28 Feb 2009 21:12:59 +0000 (13:12 -0800)

Documentation: minor grammatical fixes.

Signed-off-by: David J. Mellor <dmellor@whistlingcat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ensure proper setup of git_dir for git-hash-objectElijah Newren Sat, 28 Feb 2009 19:56:49 +0000 (12:56 -0700)

Ensure proper setup of git_dir for git-hash-object

Call setup_git_directory() before git_config() to make sure git_dir is set
to the proper value.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint-1.6.0' into maintJunio C Hamano Sat, 28 Feb 2009 22:05:09 +0000 (14:05 -0800)

Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
added missing backtick in git-apply.txt

added missing backtick in git-apply.txtDanijel Tasov Sat, 28 Feb 2009 20:03:54 +0000 (21:03 +0100)

added missing backtick in git-apply.txt

Signed-off-by: Danijel Tasov <dt@korn.shell.la>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-rebase: Update --whitespace documentationTodd Zullinger Sat, 28 Feb 2009 18:42:02 +0000 (13:42 -0500)

git-rebase: Update --whitespace documentation

The parameters accepted by the --whitespace option of "git apply" have
changed over time, and the documentation for "git rebase" was out of
sync. Remove the specific parameter list from the "git rebase"
documentation and simply point to the "git apply" documentation for
details, as is already done in the "git am" documentation.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

is_kept_pack(): final clean-upJunio C Hamano Sat, 28 Feb 2009 08:37:19 +0000 (00:37 -0800)

is_kept_pack(): final clean-up

Now is_kept_pack() is just a member lookup into a structure, we can write
it as such.

Also rewrite the sole caller of has_sha1_kept_pack() to switch on the
criteria the callee uses (namely, revs->kept_pack_only) between calling
has_sha1_kept_pack() and has_sha1_pack(), so that these two callees do not
have to take a pointer to struct rev_info as an argument.

This removes the header file dependency issue temporarily introduced by
the earlier commit, so we revert changes associated to that as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Simplify is_kept_pack()Junio C Hamano Sat, 28 Feb 2009 08:00:21 +0000 (00:00 -0800)

Simplify is_kept_pack()

This removes --unpacked=<packfile> parameter from the revision parser, and
rewrites its use in git-repack to pass a single --kept-pack-only option
instead.

The new --kept-pack-only option means just that. When this option is
given, is_kept_pack() that used to say "not on the --unpacked=<packfile>
list" now says "the packfile has corresponding .keep file".

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Consolidate ignore_packed logic moreJunio C Hamano Sat, 28 Feb 2009 07:43:37 +0000 (23:43 -0800)

Consolidate ignore_packed logic more

This refactors three loops that check if a given packfile is on the
ignore_packed list into a function is_kept_pack(). The function returns
false for a pack on the list, and true for a pack not on the list, because
this list is solely used by "git repack" to pass list of packfiles that do
not have corresponding .keep files, i.e. a packfile not on the list is
"kept".

Signed-off-by: Junio C Hamano <gitster@pobox.com>

has_sha1_kept_pack(): take "struct rev_info"Junio C Hamano Sat, 28 Feb 2009 07:30:38 +0000 (23:30 -0800)

has_sha1_kept_pack(): take "struct rev_info"

Its "ignore_packed" parameter always comes from struct rev_info. This
patch makes the function take a pointer to the surrounding structure, so
that the refactoring in the next patch becomes easier to review.

There is an unfortunate header file dependency and the easiest workaround
is to temporarily move the function declaration from cache.h to
revision.h; this will be moved back to cache.h once the function loses
this "ignore_packed" parameter altogether in the later part of the
series.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

has_sha1_pack(): refactor "pretend these packs do not... Junio C Hamano Sat, 28 Feb 2009 07:15:53 +0000 (23:15 -0800)

has_sha1_pack(): refactor "pretend these packs do not exist" interface

Most of the callers of this function except only one pass NULL to its last
parameter, ignore_packed.

Introduce has_sha1_kept_pack() function that has the function signature
and the semantics of this function, and convert the sole caller that does
not pass NULL to call this new function.

All other callers and has_sha1_pack() lose the ignore_packed parameter.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-repack: resist stray environment variableJunio C Hamano Sat, 28 Feb 2009 07:58:50 +0000 (23:58 -0800)

git-repack: resist stray environment variable

The script used $args and $existing without initializing it to empty. It
would have been confused by an environment variable the end user had
before running it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-svn - return original format_svn_date semanticsBen Walton Sat, 28 Feb 2009 03:11:45 +0000 (22:11 -0500)

git-svn - return original format_svn_date semantics

When %z was removed from the strftime call and subsituted with a
local gmt offset calculation, time() was no longer the default for
all time functions as it was with the previous localtime(shift).
This is now corrected so that format_svn_time behaves as it used to.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-svn: disable broken symlink workaround by defaultEric Wong Sat, 28 Feb 2009 03:40:16 +0000 (19:40 -0800)

git-svn: disable broken symlink workaround by default

Even though this will break things for some extremely rare repositories
used by broken Windows clients, it's probably not worth enabling this by
default as it has negatively affected many more users than it has helped
from what we've seen so far.

The extremely rare repositories that have broken symlinks in them will be
silently corrupted in import; but users can still reenable this option and
restart the import.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'cc/maint-1.6.0-bisect-fix'Junio C Hamano Sat, 28 Feb 2009 00:00:33 +0000 (16:00 -0800)

Merge branch 'cc/maint-1.6.0-bisect-fix'

* cc/maint-1.6.0-bisect-fix:
bisect: fix another instance of eval'ed string

Conflicts:
git-bisect.sh

builtin-remote: new show output style for push refspecsJay Soffian Wed, 25 Feb 2009 08:32:28 +0000 (03:32 -0500)

builtin-remote: new show output style for push refspecs

The existing output of "git remote show <remote>" with respect to push
ref specs is basically just to show the raw refspec. This patch teaches
the command to interpret the refspecs and show how each branch will be
pushed to the destination. The output gives the user an idea of what
"git push" should do if it is run w/o any arguments.

Example new output:

1a. Typical output with no push refspec (i.e. matching branches only)

$ git remote show origin
* remote origin
[...]
Local refs configured for 'git push':
master pushes to master (up to date)
next pushes to next (local out of date)

1b. Same as above, w/o querying the remote:

$ git remote show origin -n
* remote origin
[...]
Local ref configured for 'git push' (status not queried):
(matching) pushes to (matching)

2a. With a forcing refspec (+), and a new topic
(something like push = refs/heads/*:refs/heads/*):

$ git remote show origin
* remote origin
[...]
Local refs configured for 'git push':
master pushes to master (fast forwardable)
new-topic pushes to new-topic (create)
next pushes to next (local out of date)
pu forces to pu (up to date)

2b. Same as above, w/o querying the remote

$ git remote show origin -n
* remote origin
[...]
Local refs configured for 'git push' (status not queried):
master pushes to master
new-topic pushes to new-topic
next pushes to next
pu forces to pu

3. With a remote configured as a mirror:

* remote backup
[...]
Local refs will be mirrored by 'git push'

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-remote: new show output styleJay Soffian Wed, 25 Feb 2009 08:32:27 +0000 (03:32 -0500)

builtin-remote: new show output style

The existing output of "git remote show <remote>" is too verbose for the
information it provides. This patch teaches it to provide more
information in less space.

The output for push refspecs is addressed in the next patch.

Before the patch:

$ git remote show origin
* remote origin
URL: git://git.kernel.org/pub/scm/git/git.git
HEAD branch: master
Remote branch merged with 'git pull' while on branch master
master
Remote branch merged with 'git pull' while on branch next
next
Remote branches merged with 'git pull' while on branch octopus
foo bar baz frotz
New remote branch (next fetch will store in remotes/origin)
html
Stale tracking branch (use 'git remote prune')
bogus
Tracked remote branches
maint
man
master
next
pu
todo

After this patch:

$ git remote show origin
* remote origin
URL: git://git.kernel.org/pub/scm/git/git.git
HEAD branch: master
Remote branches:
bogus stale (use 'git remote prune' to remove)
html new (next fetch will store in remotes/origin)
maint tracked
man tracked
master tracked
next tracked
pu tracked
todo tracked
Local branches configured for 'git pull':
master rebases onto remote master
next rebases onto remote next
octopus merges with remote foo
and with remote bar
and with remote baz
and with remote frotz

$ git remote show origin -n
* remote origin
URL: git://git.kernel.org/pub/scm/git/git.git
HEAD branch: (not queried)
Remote branches: (status not queried)
bogus
maint
man
master
next
pu
todo
Local branches configured for 'git pull':
master rebases onto remote master
next rebases onto remote next
octopus merges with remote foo
and with remote bar
and with remote baz
and with remote frotz

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote: make guess_remote_head() use exact HEAD lookup... Jeff King Fri, 27 Feb 2009 19:10:06 +0000 (14:10 -0500)

remote: make guess_remote_head() use exact HEAD lookup if it is available

Our usual method for determining the ref pointed to by HEAD
is to compare HEAD's sha1 to the sha1 of all refs, trying to
find a unique match.

However, some transports actually get to look at HEAD
directly; we should make use of that information when it is
available. Currently, only http remotes support this
feature.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-remote: add set-head subcommandJay Soffian Wed, 25 Feb 2009 08:32:25 +0000 (03:32 -0500)

builtin-remote: add set-head subcommand

Provide a porcelain command for setting and deleting
$GIT_DIR/remotes/<remote>/HEAD.

While we're at it, document what $GIT_DIR/remotes/<remote>/HEAD is all
about.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-remote: teach show to display remote HEADJay Soffian Wed, 25 Feb 2009 08:32:24 +0000 (03:32 -0500)

builtin-remote: teach show to display remote HEAD

This is in preparation for teaching remote how to set
refs/remotes/<remote>/HEAD to match what HEAD is set to at <remote>, but
is useful in its own right.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-remote: fix two inconsistencies in the output... Jay Soffian Wed, 25 Feb 2009 08:32:23 +0000 (03:32 -0500)

builtin-remote: fix two inconsistencies in the output of "show <remote>"

Remote and stale branches are emitted in alphabetical order, but new and
tracked branches are not. So sort the latter to be consistent with the
former. This also lets us use more efficient string_list_has_string()
instead of unsorted_string_list_has_string().

"show <remote>" prunes symrefs, but "show <remote> -n" does not. Fix the
latter to match the former.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-remote: make get_remote_ref_states() always... Jay Soffian Wed, 25 Feb 2009 08:32:22 +0000 (03:32 -0500)

builtin-remote: make get_remote_ref_states() always populate states.tracked

When not querying the remote, show() was having to populate
states.tracked itself. It makes more sense for get_remote_ref_states()
to do this consistently. Since show() is the only caller of
get_remote_ref_states() with query=0, this change does not affect
other callers.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-remote: rename variables and eliminate redundan... Jay Soffian Wed, 25 Feb 2009 08:32:21 +0000 (03:32 -0500)

builtin-remote: rename variables and eliminate redundant function call

- The variable name "remote" is used as both a "char *" and as a "struct
remote *"; this is confusing, so rename the former to remote_name.

- Consistently refer to the refs returned by transport_get_remote_refs()
as remote_refs.

- There is no need to call "sort_string_list(&branch_list)" as
branch_list is populated via string_list_insert(), which maintains its
order.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-remote: remove unused code in get_ref_statesJay Soffian Wed, 25 Feb 2009 08:32:20 +0000 (03:32 -0500)

builtin-remote: remove unused code in get_ref_states

get_ref_states() populates the util pointer of the string_list_item's
that it adds to states->new and states->tracked, but nothing ever uses
the pointer, so we can get rid of the extra code.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-remote: refactor duplicated cleanup codeJay Soffian Wed, 25 Feb 2009 08:32:19 +0000 (03:32 -0500)

builtin-remote: refactor duplicated cleanup code

This patch moves identical lines of code into a cleanup function. The
function has two callers and is about to gain a third.

Also removed a bogus NEEDSWORK comment per Daniel Barkalow:

Actually, the comment is wrong; "remote" comes from remote_get(),
which returns things from a cache in remote.c; there could be a
remote_put() to let the code know that the caller is done with the
object, but it wouldn't presently do anything.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

string-list: new for_each_string_list() functionJay Soffian Wed, 25 Feb 2009 08:32:18 +0000 (03:32 -0500)

string-list: new for_each_string_list() function

Add a convenience function for iterating over a string_list's items via
a callback.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote: make match_refs() not short-circuitJay Soffian Wed, 25 Feb 2009 08:32:17 +0000 (03:32 -0500)

remote: make match_refs() not short-circuit

match_refs() returns non-zero if there is an error in
match_explicit_refs(), without handling any remaining pattern ref specs.

Its existing callers exit upon receiving non-zero, so a partial result
is of no consequence to them; however a new caller, builtin-remote, is
interested in the complete result even if there are errors in
match_explicit_refs().

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote: make match_refs() copy src ref before assigning... Jay Soffian Wed, 25 Feb 2009 08:32:16 +0000 (03:32 -0500)

remote: make match_refs() copy src ref before assigning to peer_ref

In some instances, match_refs() sets the peer_ref field of refs in the
dst list such that it points to a ref in the src list. This prevents
callers from freeing both the src and dst lists, as doing so would cause
a double-free since free_refs() frees the peer_ref.

As well, the following configuration causes two refs in the dst list to
have the same peer_ref, which can also lead to a double-free:

push = refs/heads/master:refs/heads/backup
push = refs/heads/master:refs/heads/master

Existing callers of match_heads() call it only once and then terminate,
w/o ever bothering to free the src or dst lists, so this is not
currently a problem.

This patch modifies match_refs() to first copy any refs it plucks from
the src list before assigning them as a peer_ref. This allows
builtin-remote, a future caller, to free the src and dst lists.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote: let guess_remote_head() optionally return all... Jay Soffian Fri, 27 Feb 2009 19:10:05 +0000 (14:10 -0500)

remote: let guess_remote_head() optionally return all matches

Determining HEAD is ambiguous since it is done by comparing SHA1s.

In the case of multiple matches we return refs/heads/master if it
matches, else we return the first match we encounter. builtin-remote
needs all matches returned to it, so add a flag for it to request such.

To be simple and consistent, the return value is now a copy (including
peer_ref) of the matching refs.

Originally contributed by Jeff King along with the prior commit as a
single patch.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote: make copy_ref() perform a deep copyJay Soffian Fri, 27 Feb 2009 19:10:04 +0000 (14:10 -0500)

remote: make copy_ref() perform a deep copy

To ensure that copied refs can always be freed w/o causing a
double-free, make copy_ref() perform a deep copy.

Also have copy_ref() return NULL if asked to copy NULL to simplify
things for the caller.

Background: currently copy_ref() performs a shallow copy. This is fine
for current callers who never free the result and/or only copy refs
which contain NULL pointers. But copy_ref() is about to gain a new
caller (guess_remote_head()) which copies refs where peer_ref is not
NULL and the caller of guess_remote_head() will want to free the result.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect: fix another instance of eval'ed stringChristian Couder Fri, 27 Feb 2009 06:31:22 +0000 (07:31 +0100)

bisect: fix another instance of eval'ed string

When there is nothing to be skipped, the output from
rev-list --bisect-vars was eval'ed without first being
strung together with &&; this is probably not a problem
as it is much less likely to be a bad input than the list
handcrafted by the filter_skip function, but it still is
a good discipline.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bash completion: add --format= and --oneline options... Teemu Likonen Tue, 24 Feb 2009 13:33:29 +0000 (15:33 +0200)

bash completion: add --format= and --oneline options for "git log"

We also add --format= completion for "git show".

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'cc/maint-1.6.0-bisect-fix'Junio C Hamano Fri, 27 Feb 2009 09:03:21 +0000 (01:03 -0800)

Merge branch 'cc/maint-1.6.0-bisect-fix'

* cc/maint-1.6.0-bisect-fix:
bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped

Conflicts:
git-bisect.sh

bisect: fix quoting TRIED revs when "bad" commit is... Christian Couder Fri, 27 Feb 2009 06:31:22 +0000 (07:31 +0100)

bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped

When the "bad" commit was also "skip"ped and when more than one
commit was skipped, the "filter_skipped" function would have
printed something like:

bisect_rev=<hash1>|<hash2>

(where <hash1> and <hash2> are hexadecimal sha1 hashes)

and this would have been evaled later as piping "bisect_rev=<hash1>"
into "<hash2>", which would have failed.

So this patch makes the "filter_skipped" function properly quote
what it outputs, so that it will print something like:

bisect_rev='<hash1>|<hash2>'

which will be properly evaled later. The caller was not stopping
properly because the scriptlet this function returned to be evaled
was not strung together with && and because of this, an error in
an earlier part of the output was simply ignored.

A test case is added to the test suite.

And while at it, we also initialize the VARS, FOUND and TRIED
variables, so that we protect ourselves from environment variables
the user may have with these names.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-am: make --abort less dangerousJunio C Hamano Thu, 26 Feb 2009 19:24:29 +0000 (11:24 -0800)

git-am: make --abort less dangerous

When you are in the middle of "git rebase", "git am --abort" by mistake
would have referred to nonexistent ORIG_HEAD and barfed, or worse yet, used
a stale ORIG_HEAD and taken you to an unexpected commit.

Also the option parsing did not reject "git am --abort --skip".

Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-am: Keep index in case of abort with dirty indexMichael J Gruber Thu, 26 Feb 2009 09:52:53 +0000 (10:52 +0100)

git-am: Keep index in case of abort with dirty index

git am --abort resets the index unconditionally. But in case a previous
git am exited due to a dirty index it is preferable to keep that index.
Make it so.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5540-http-push.sh: avoid non-portable grep -PJay Soffian Thu, 26 Feb 2009 23:44:40 +0000 (18:44 -0500)

t5540-http-push.sh: avoid non-portable grep -P

OS X's GNU grep does not support -P/--perl-regexp.

We use a basic RE instead, and simplify the pattern slightly by
replacing '+' with '*' so it can be more easily expressed using a basic
RE. The important part of pattern, checking for a SHA-1 has suffix in
the successful PUT/MOVE operations, remains the same. Also, a-z instead
of a-f was an obvious mistake in the original RE. Here are samples of
what we want to match:

127.0.0.1 - - [26/Feb/2009:22:38:13 +0000] "PUT /test_repo.git/objects/3e/a4fbb9e18a401a6463c595d08118fcb9fb7426_fab55116904c665a95438bcc78521444a7db6096 HTTP/1.1" 201 277
127.0.0.1 - - [26/Feb/2009:22:38:13 +0000] "MOVE /test_repo.git/objects/3e/a4fbb9e18a401a6463c595d08118fcb9fb7426_fab55116904c665a95438bcc78521444a7db6096 HTTP/1.1" 201 277

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix odb_mkstemp() on AIXMike Ralphson Thu, 26 Feb 2009 15:31:52 +0000 (16:31 +0100)

Fix odb_mkstemp() on AIX

The AIX mkstemp() modifies its template parameter to an empty string if
the call fails. The existing code had already recomputed the template,
but too late to be good.

See also 6ff6af62, which fixed this problem in a different spot.

Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote: simplify guess_remote_head()Jay Soffian Wed, 25 Feb 2009 08:32:14 +0000 (03:32 -0500)

remote: simplify guess_remote_head()

This function had complications which made it hard to extend.

- It used to do two things: find the HEAD ref, and then find a
matching ref, optionally returning the former via assignment to a
passed-in pointer. Since finding HEAD is a one-liner, just have a
caller do it themselves and pass it as an argument.

- It used to manually search through the ref list for
refs/heads/master; this can be a one-line call to
find_ref_by_name.

Originally contributed by Jeff King along with the next commit as a
single patch.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

move locate_head() to remote.cJay Soffian Wed, 25 Feb 2009 08:32:13 +0000 (03:32 -0500)

move locate_head() to remote.c

Move locate_head() to remote.c and rename it to guess_remote_head() to
more accurately reflect what it does. This is in preparation for being
able to call it from builtin-remote.c

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

move duplicated ref_newer() to remote.cJay Soffian Wed, 25 Feb 2009 08:32:12 +0000 (03:32 -0500)

move duplicated ref_newer() to remote.c

ref_newer() appears to have been copied from builtin-send-pack.c to
http-push.c via cut and paste. This patch moves the function and its
helper unmark_and_free() to remote.c. There was a slight difference
between the two implementations, one used TMP_MARK for the mark, the
other used 1. Per Jeff King, I went with TMP_MARK as more correct.

This is in preparation for being able to call it from builtin-remote.c

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

move duplicated get_local_heads() to remote.cJay Soffian Wed, 25 Feb 2009 08:32:11 +0000 (03:32 -0500)

move duplicated get_local_heads() to remote.c

get_local_heads() appears to have been copied from builtin-send-pack.c
to http-push.c via cut and paste. This patch moves the function and its
helper one_local_ref() to remote.c.

The two copies of one_local_ref() were not identical. I used the more
recent version from builtin-send-pack.c after confirming with Jeff King
that it was an oversight that commit 30affa1e did not update both
copies.

This is in preparation for being able to call it from builtin-remote.c

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refactor find_ref_by_name() to accept const listJeff King Wed, 25 Feb 2009 08:32:10 +0000 (03:32 -0500)

refactor find_ref_by_name() to accept const list

Since it doesn't actually touch its argument, this makes
sense.

However, we still want to return a non-const version (which
requires a cast) so that this:

struct ref *a, *b;
a = find_ref_by_name(b);

works. Unfortunately, you can also silently strip the const
from a variable:

struct ref *a;
const struct ref *b;
a = find_ref_by_name(b);

This is a classic C const problem because there is no way to
say "return the type with the same constness that was passed
to us"; we provide the same semantics as standard library
functions like strchr.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add basic http clone/fetch testsJeff King Wed, 25 Feb 2009 08:32:09 +0000 (03:32 -0500)

add basic http clone/fetch tests

This was mostly being tested implicitly by the "http push"
tests. But making a separate test script means that:

- we will run fetch tests even when http pushing support
is not built

- when there are failures on fetching, they are easier to
see and isolate, as they are not in the middle of push
tests

This script defaults to running the webserver on port 5550,
and puts the original t5540 on port 5540, so that the two
can be run simultaneously without conflict (but both still
respect an externally set LIB_HTTPD_PORT).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test scripts: refactor start_httpd helperJeff King Wed, 25 Feb 2009 08:32:08 +0000 (03:32 -0500)

test scripts: refactor start_httpd helper

There are some redirects and some error checking that need
to be done by the caller; let's move both into the
start_httpd function so that all callers don't have to
repeat them (there is only one caller now, but another will
follow in this series).

This doesn't violate any assumptions that aren't already
being made by lib-httpd, which is happy to say "skipping"
and call test_done for a number of other cases.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

GIT 1.6.2-rc2 v1.6.2-rc2Junio C Hamano Wed, 25 Feb 2009 22:50:52 +0000 (14:50 -0800)

GIT 1.6.2-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/maint-1.6.0-pack-directory'Junio C Hamano Wed, 25 Feb 2009 22:48:30 +0000 (14:48 -0800)

Merge branch 'jc/maint-1.6.0-pack-directory'

* jc/maint-1.6.0-pack-directory:
Make sure objects/pack exists before creating a new pack

Make sure objects/pack exists before creating a new... Junio C Hamano Wed, 25 Feb 2009 07:11:29 +0000 (23:11 -0800)

Make sure objects/pack exists before creating a new pack

In a repository created with git older than f49fb35 (git-init-db: create
"pack" subdirectory under objects, 2005-06-27), objects/pack/ directory is
not created upon initialization. It was Ok because subdirectories are
created as needed inside directories init-db creates, and back then,
packfiles were recent invention.

After the said commit, new codepaths started relying on the presense of
objects/pack/ directory in the repository. This was exacerbated with
8b4eb6b (Do not perform cross-directory renames when creating packs,
2008-09-22) that moved the location temporary pack files are created from
objects/ directory to objects/pack/ directory, because moving temporary to
the final location was done carefully with lazy leading directory creation.

Many packfile related operations in such an old repository can fail
mysteriously because of this.

This commit introduces two helper functions to make things work better.

- odb_mkstemp() is a specialized version of mkstemp() to refactor the
code and teach it to create leading directories as needed;

- odb_pack_keep() refactors the code to create a ".keep" file while
create leading directories as needed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Allow HTTP tests to run on DarwinJay Soffian Wed, 25 Feb 2009 08:28:15 +0000 (03:28 -0500)

Allow HTTP tests to run on Darwin

This patch allows the HTTP tests to run on OS X 10.5. It is not
sufficient to be able to pass in LIB_HTTPD_PATH and
LIB_HTTPD_MODULE_PATH alone, as the apache.conf also needs a couple
tweaks.

These changes are put into an <IfDefine> to keep them Darwin specific,
but this means lib-httpd.sh needs to be modified to pass -DDarwin to
apache when running on Darwin. As long as we're making this change to
lib-httpd.sh, we may as well set LIB_HTTPD_PATH and
LIB_HTTPD_MODULE_PATH to appropriate default values for the platform.

Note that we now pass HTTPD_PARA to apache at shutdown as well.
Otherwise apache will emit a harmless, but noisy warning that LogFormat
is an unknown directive.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix typo in contrib/examples/git-svnimport.txtMichael J Gruber Wed, 25 Feb 2009 14:05:17 +0000 (15:05 +0100)

Fix typo in contrib/examples/git-svnimport.txt

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitattributes.txt: Path matching rules are explained... Johannes Sixt Wed, 25 Feb 2009 07:54:42 +0000 (08:54 +0100)

gitattributes.txt: Path matching rules are explained in gitignore.txt

The rules how the patterns are matched against path names are the same
for .gitattribute and .gitignore files.

This also replace the notion "glob pattern" by "pattern" because
gitignore.txt talks about "glob" only in some contexts where the pattern
is mentioned.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file.c: fix typoFelipe Contreras Tue, 24 Feb 2009 21:59:05 +0000 (23:59 +0200)

sha1_file.c: fix typo

it's != its

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git add: trivial codestyle cleanupFelipe Contreras Tue, 24 Feb 2009 21:59:03 +0000 (23:59 +0200)

git add: trivial codestyle cleanup

Global static variables don't need to be initialized to 0/NULL.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

README: fix path to "gitcvs-migration.txt" and be more... Christian Couder Tue, 24 Feb 2009 20:16:37 +0000 (21:16 +0100)

README: fix path to "gitcvs-migration.txt" and be more consistent

README suggested to look at "Documentation/gittutorial.txt" for the
tutorial and to use "man git-commandname" for documentation of each
command.

This was not consistent because the tutorial can also be available with
"man gittutorial" once git is installed, and the documentation for each
command can be available at "Documentation/git-commandname.txt" before
installing git.

This patch tries to make the description more consistent. It also fixes
the path to the cvs-migration documentation that changed from
"Documentation/cvs-migration.txt" to "Documentation/gitcvs-migration.txt".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace: Fixed a minor typo in an error message.Allan Caffee Wed, 25 Feb 2009 01:22:20 +0000 (20:22 -0500)

trace: Fixed a minor typo in an error message.

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Docs: Expand explanation of the use of + in git push... Marc Branchaud Thu, 19 Feb 2009 17:39:47 +0000 (12:39 -0500)

Docs: Expand explanation of the use of + in git push refspecs.

Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-quiltimport: preserve standard input to be able... Gerrit Pape Tue, 24 Feb 2009 09:00:06 +0000 (09:00 +0000)

git-quiltimport: preserve standard input to be able to read user input

When run without --author and it fails to determine an author, git
quiltimport tries `read patch_author` to get user input, but standard
input has been redirected to the patch series file. This commit lets
quiltimport read the series file through file descriptor 3 so that the
standard input is preserved.

Reported by Uwe Kleine-König through http://bugs.debian.org/515910

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

never fallback relative times to absoluteJeff King Tue, 24 Feb 2009 05:42:16 +0000 (00:42 -0500)

never fallback relative times to absolute

Previously, for dates older than 12 months we fell back to just giving the
absolute time. This can be a bit jarring when reading a list of times.

Instead, let's switch to "Y years, M months" for five years, and then just
"Y years" after that.

No particular reason on the 5 year cutoff except that it seemed reasonable
to me.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add tests for git log --pretty, --format and --oneline.Felipe Contreras Tue, 24 Feb 2009 21:06:37 +0000 (23:06 +0200)

Add tests for git log --pretty, --format and --oneline.

More specifically; --pretty=format, tformat and new %foo shortcut.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add --oneline that is a synonym to "--pretty=oneline... Nanako Shiraishi Tue, 24 Feb 2009 09:59:16 +0000 (18:59 +0900)

Add --oneline that is a synonym to "--pretty=oneline --abbrev-commit"

These two are often used together but are too long to type.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Give short-hands to --pretty=tformat:%formatstringNanako Shiraishi Tue, 24 Feb 2009 09:59:15 +0000 (18:59 +0900)

Give short-hands to --pretty=tformat:%formatstring

Allow --pretty="%h %s" (and --format="%h %s") as shorthand for an often
used option --pretty=tformat:"%h %s".

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add --format that is a synonym to --prettyNanako Shiraishi Tue, 24 Feb 2009 09:59:14 +0000 (18:59 +0900)

Add --format that is a synonym to --pretty

Some people prefer to call the pretty-print styles "format", and get
annoyed to see "git log --format=short" fail. Introduce it as a synonym
to --pretty so that both can be used.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Install builtins with the user and group of the install... Gerrit Pape Tue, 24 Feb 2009 08:58:16 +0000 (08:58 +0000)

Install builtins with the user and group of the installing personality

If 'make install' was run with sufficient privileges, then the installed
builtins in gitexecdir, which are either hardlinked, symlinked, or copied,
would receive the user and group of whoever built git. With this commit
the initial hardlink or copy is done from the installation tree and not
the build tree to fix this.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fixup: Add bare repository indicator for __git_ps1Marius Storm-Olsen Sat, 21 Feb 2009 14:48:43 +0000 (15:48 +0100)

Fixup: Add bare repository indicator for __git_ps1

Signed-off-by: Marius Storm-Olsen <git@storm-olsen.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge git://git.bogomips.org/git-svnJunio C Hamano Wed, 25 Feb 2009 05:13:32 +0000 (21:13 -0800)

Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
git-svn fix to avoid using strftime %z

Convert git-* invocations to "git *" in the svnimport... Abhijit Menon-Sen Wed, 25 Feb 2009 03:03:14 +0000 (08:33 +0530)

Convert git-* invocations to "git *" in the svnimport example.

After these changes, git-svnimport worked fine for me.

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-svn fix to avoid using strftime %zBen Walton Tue, 24 Feb 2009 19:44:49 +0000 (14:44 -0500)

git-svn fix to avoid using strftime %z

%z isn't available on all platforms in the date formatting
routines. Provide a workalike capability that should be
more portable.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Acked-by: Eric Wong <normalperson@yhbt.net>

send-email: don't create temporary compose file until... Jay Soffian Mon, 23 Feb 2009 18:51:37 +0000 (13:51 -0500)

send-email: don't create temporary compose file until it is needed

Commit eed6ca7 caused a minor regression when it switched to using
tempfile() to generate the temporary compose file. Since tempfile()
creates the file at the time it generates the filename, zero-length
temporary files are being left behind unless --compose is used (in which
case the file is cleaned up).

This patch fixes the regression by not calling tempfile() to generate
the compose filename unless --compose is in use.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge git://git.bogomips.org/git-svnJunio C Hamano Tue, 24 Feb 2009 03:14:13 +0000 (19:14 -0800)

Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
git-svn: read the dcommit url from the config file on a per remote basis
git-svn: fix delete+add branch tracking with empty files
git-svn: Create leading directories in create-ignore

write_index(): update index_state->timestamp after... Kjetil Barvik Mon, 23 Feb 2009 18:02:57 +0000 (19:02 +0100)

write_index(): update index_state->timestamp after flushing to disk

Since this timestamp is used to check for racy-clean files, it is
important to keep it uptodate.

For the 'git checkout' command without the '-q' option, this make a
huge difference. Before, each and every file which was updated, was
racy-clean after the call to unpack_trees() and write_index() but
before the GIT process ended.

And because of the call to show_local_changes() in builtin-checkout.c,
we ended up reading those files back into memory, doing a SHA1 to
check if the files was really different from the index. And, of
course, no file was different.

With this fix, 'git checkout' without the '-q' option should now be
almost as fast as with the '-q' option, but not quite, as we still do
some few lstat(2) calls more without the '-q' option.

Below is some average numbers for 10 checkout's to v2.6.27 and 10 to
v2.6.25 of the Linux kernel, to show the difference:

before (git version 1.6.2.rc1.256.g58a87):
7.860 user 2.427 sys 19.465 real 52.8% CPU faults: 0 major 95331 minor
after:
6.184 user 2.160 sys 17.619 real 47.4% CPU faults: 0 major 38994 minor

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: avoid syncing duplicate changesPete Wyckoff Wed, 18 Feb 2009 18:12:14 +0000 (13:12 -0500)

git-p4: avoid syncing duplicate changes

When a particular changeset affects multiple depot paths, it
will appear multiple times in the output of "p4 changes".
Filter out the duplicates to avoid the extra empty commits that
this otherwise would create.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add bare repository indicator for __git_ps1Marius Storm-Olsen Sat, 21 Feb 2009 14:48:43 +0000 (15:48 +0100)

Add bare repository indicator for __git_ps1

Prefixes the branch name with "BARE:" if you're in a
bare repository.

Signed-off-by: Marius Storm-Olsen <git@storm-olsen.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-svn: read the dcommit url from the config file... Peter Oberndorfer Mon, 23 Feb 2009 11:02:53 +0000 (12:02 +0100)

git-svn: read the dcommit url from the config file on a per remote basis

The commit url for dcommit is determined in the following order:
commandline option --commit-url
svn.commiturl
svn-remote.<name>.commiturl
svn-remote.<name>.url

Signed-off-by: Peter Oberndorfer <kumbayo84@arcor.de>
Acked-by: Eric Wong <normalperson@yhbt.net>

git-svn: fix delete+add branch tracking with empty... Eric Wong Mon, 23 Feb 2009 04:25:00 +0000 (20:25 -0800)

git-svn: fix delete+add branch tracking with empty files

Original bug report and test case by Björn Steinbrink.

Björn Steinbrink <B.Steinbrink@gmx.de> wrote:
> Hi Eric,
>
> seems that the empty symlink stuff gets confused about which revision to
> use when looking for the parent's file.
>
> r3 = f1a6fcf6b0a1c4a373d0b2b65a3d70700084f361 (tags/1.0.1)
> Found possible branch point: file:///home/doener/h/svn/tags/1.0 => file:///home/doener/h/svn/branches/1.0, 4
> Found branch parent: (1.0) 63ae640ba01014ecbb3df590999ed1fa5914545b
> Following parent with do_switch
> Successfully followed parent
> r5 = 26fcfef5bcced97ab74faf1af7341a2ae0d272aa (1.0)
> Found possible branch point: file:///home/doener/h/svn/branches/1.0 => file:///home/doener/h/svn/tags/1.0.1, 5
> Found branch parent: (tags/1.0.1) 26fcfef5bcced97ab74faf1af7341a2ae0d272aa
> Following parent with do_switch
> Scanning for empty symlinks, this may take a while if you have many empty files
> You may disable this with `git config svn.brokenSymlinkWorkaround false'.
> This may be done in a different terminal without restarting git svn
> Filesystem has no item: File not found: revision 3, path '/branches/1.0/file' at /usr/local/libexec/git-core/git-svn line 3318
>
> Note how it tries to look at revision 3 instead of revision 5 (which it
> correctly detected as the parent). The import succeeds when
> svn.brokenSymlinkWorkaround is set to false. Testcase below.

Signed-off-by: Eric Wong <normalperson@yhbt.net>

git-svn: Create leading directories in create-ignoreBrian Gernhardt Thu, 19 Feb 2009 18:08:04 +0000 (13:08 -0500)

git-svn: Create leading directories in create-ignore

Since SVN tracks empty directories and git does not, we can not assume
that the directory exists when creating .gitignore files.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Acked-by: Eric Wong <normalperson@yhbt.net>

git config: don't allow --get-color* and variable typeFelipe Contreras Sat, 21 Feb 2009 00:49:29 +0000 (02:49 +0200)

git config: don't allow --get-color* and variable type

Doing so would be incoherent since --get-color would pick a color slot
and ignore the variable type option (e.g. --bool), and the type would
require a variable name.

Suggested by Junio C Hamano.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git config: don't allow extra arguments for -e or -l.Felipe Contreras Sat, 21 Feb 2009 00:49:28 +0000 (02:49 +0200)

git config: don't allow extra arguments for -e or -l.

As suggested by Johannes Schindelin.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git config: don't allow multiple variable typesFelipe Contreras Sat, 21 Feb 2009 00:49:27 +0000 (02:49 +0200)

git config: don't allow multiple variable types

Only --bool, --int, or --bool-or-int can be used, but not any
combination of them.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git config: don't allow multiple config file locationsFelipe Contreras Sat, 21 Feb 2009 00:49:26 +0000 (02:49 +0200)

git config: don't allow multiple config file locations

Either --global, --system, or --file can be used, but not any
combination.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git config: reorganize to use parseoptFelipe Contreras Sat, 21 Feb 2009 00:49:25 +0000 (02:49 +0200)

git config: reorganize to use parseopt

This patch has benefited from comments by Johannes
Schindelin and Junio C Hamano.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git config: reorganize get_color*Felipe Contreras Sat, 21 Feb 2009 00:48:57 +0000 (02:48 +0200)

git config: reorganize get_color*

In preparation for parseopt.

Also remove some unecessary comments since the usage is described in the
documentation.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git config: trivial rename in preparation for parseoptFelipe Contreras Sat, 21 Feb 2009 00:48:56 +0000 (02:48 +0200)

git config: trivial rename in preparation for parseopt

Essentially this replaces 'file' with 'prefix' in the cases where the
variable is used as a prefix, which is consistent with other git
commands.

When using the --list option general errors where not properly reported,
only errors related with the 'file'. Now they are reported, and 'file'
is irrelevant.

That reduces the rest of 'file' usage to nothing, therefore now only
'prefix' remains.

Suggested by Johannes Schindelin.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git_config(): not having a per-repo config file is... Felipe Contreras Sat, 21 Feb 2009 00:48:55 +0000 (02:48 +0200)

git_config(): not having a per-repo config file is not an error

Currently git_config() returns an error if there is no repo config file
available (cwd is not a git repo); it will correctly parse the system
and global config files, but still return an error.

It doesn't affect anything else since almost nobody is checking for the
return code (with the exception of 'git remote update').

A reorganization in 'git config' would benefit from being able to
properly detect errors in git_config() without the noise generated when
cwd is not a git repo.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git config: trivial cleanup for editor actionJohannes Schindelin Sat, 21 Feb 2009 00:48:54 +0000 (02:48 +0200)

git config: trivial cleanup for editor action

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git config: codestyle cleanupsFelipe Contreras Sat, 21 Feb 2009 00:48:53 +0000 (02:48 +0200)

git config: codestyle cleanups

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format-patch: support deep threadingThomas Rast Thu, 19 Feb 2009 21:26:33 +0000 (22:26 +0100)

format-patch: support deep threading

For deep threading mode, i.e., the mode that gives a thread structured
like

+ [PATCH 0/n] Cover letter
`-+ [PATCH 1/n] First patch
`-+ [PATCH 2/n] Second patch
`-+ ...

we currently have to use 'git send-email --thread' (the default). On
the other hand, format-patch also has a --thread option which gives
shallow mode, i.e.,

+ [PATCH 0/n] Cover letter
|-+ [PATCH 1/n] First patch
|-+ [PATCH 2/n] Second patch
...

To reduce the confusion resulting from having two indentically named
features in different tools giving different results, let format-patch
take an optional argument '--thread=deep' that gives the same output
as 'send-mail --thread'. With no argument, or 'shallow', behave as
before. Also add a configuration variable format.thread with the same
semantics.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format-patch: thread as reply to cover letter even... Thomas Rast Thu, 19 Feb 2009 21:26:32 +0000 (22:26 +0100)

format-patch: thread as reply to cover letter even with in-reply-to

Currently, format-patch --thread --cover-letter --in-reply-to $parent
makes all mails, including the cover letter, a reply to $parent.
However, we would want the reader to consider the cover letter above
all the patches.

This changes the semantics so that only the cover letter is a reply to
$parent, while all the patches are formatted as replies to the cover
letter.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format-patch: track several referencesThomas Rast Thu, 19 Feb 2009 21:26:31 +0000 (22:26 +0100)

format-patch: track several references

Currently, format-patch can only track a single reference (the
In-Reply-To:) for each mail. To ensure proper threading, we should
list all known references for every mail.

Change the rev_info.ref_message_id field to a string_list, so that we
can append references at will, and change the output formatting
routines to print all of them in the References: header. The last
entry in the list is implicitly assumed to be the In-Reply-To:, which
gives output consistent with RFC 2822:

The "References:" field will contain the contents of the parent's
"References:" field (if any) followed by the contents of the
parent's "Message-ID:" field (if any).

Note that this is just preparatory work; nothing uses it yet, so all
"References:" fields in the output are still only one deep.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'for-junio' of git://source.winehq.org... Junio C Hamano Sat, 21 Feb 2009 18:38:04 +0000 (10:38 -0800)

Merge branch 'for-junio' of git://source.winehq.org/~julliard/git/git

* 'for-junio' of git://source.winehq.org/~julliard/git/git:
Add a README in the contrib/emacs directory.
git.el: Improve the confirmation message on remove and revert.
git.el: Make sure that file lists are sorted as they are created.

Add a README in the contrib/emacs directory.Alexandre Julliard Mon, 16 Feb 2009 10:40:29 +0000 (11:40 +0100)

Add a README in the contrib/emacs directory.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

git.el: Improve the confirmation message on remove... Alexandre Julliard Mon, 16 Feb 2009 10:40:08 +0000 (11:40 +0100)

git.el: Improve the confirmation message on remove and revert.

If there's only one file, print its name instead of just "1 file".

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

git.el: Make sure that file lists are sorted as they... Alexandre Julliard Mon, 16 Feb 2009 10:39:11 +0000 (11:39 +0100)

git.el: Make sure that file lists are sorted as they are created.

This avoids a possibly redundant sort in git-update-status-files and
git-status-filenames-map, and allows callers to continue using the
list without having to copy it.

It also fixes the confusing success messages reported by Brent
Goodrick.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

Support 'raw' date formatLinus Torvalds Fri, 20 Feb 2009 22:15:22 +0000 (14:15 -0800)

Support 'raw' date format

Talking about --date, one thing I wanted for the 1234567890 date was to
get things in the raw format. Sure, you get them with --pretty=raw, but it
felt a bit sad that you couldn't just ask for the date in raw format.

So here's a throw-away patch (meaning: I won't be re-sending it, because I
really don't think it's a big deal) to add "--date=raw". It just prints
out the internal raw git format - seconds since epoch plus timezone (put
another way: 'date +"%s %z"' format)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Test git-patch-idThomas Rast Thu, 19 Feb 2009 11:13:42 +0000 (12:13 +0100)

Test git-patch-id

So far, git-patch-id was untested. Add some simple checks for output
format and patch (in)equality.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Test rev-list --parents/--childrenThomas Rast Thu, 19 Feb 2009 11:13:41 +0000 (12:13 +0100)

Test rev-list --parents/--children

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Test log --decorateThomas Rast Thu, 19 Feb 2009 11:13:40 +0000 (12:13 +0100)

Test log --decorate

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Test fsck a bit harderThomas Rast Thu, 19 Feb 2009 11:13:39 +0000 (12:13 +0100)

Test fsck a bit harder

git-fsck, of all tools, has very few tests. This adds some more:
* a corrupted object;
* a branch pointing to a non-commit;
* a tag pointing to a nonexistent object;
* and a tag pointing to an object of a type other than what the tag
itself claims.

Only the first two are caught. At least the third probably should,
too, but currently slips through.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Test log --graphThomas Rast Thu, 19 Feb 2009 11:13:38 +0000 (12:13 +0100)

Test log --graph

So far there were no tests checking that log --graph actually works.

Note that the tests strip trailing whitespace, as the current --graph
emits trailing whitespace on lines that do not contain anything but
graph lines.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>