git.git
14 years agogit-svn: allow subset of branches/tags to be specified in glob spec
Jay Soffian [Sat, 23 Jan 2010 08:30:01 +0000 (03:30 -0500)]
git-svn: allow subset of branches/tags to be specified in glob spec

For very large projects it is useful to be able to clone a subset of the
upstream SVN repo's branches. Allow for this by letting the left-side of
the branches and tags glob specs contain a brace-delineated comma-separated
list of names. e.g.:

branches = branches/{red,green}/src:refs/remotes/branches/*

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: allow UUID to be manually remapped via rewriteUUID
Jay Soffian [Sat, 23 Jan 2010 08:30:00 +0000 (03:30 -0500)]
git-svn: allow UUID to be manually remapped via rewriteUUID

In certain situations it may be necessary to manually remap an svn
repostitory UUID. For example:

                  o--- [git-svn clone]
                 /
[origin svn repo]
                 \
                  o--- [svnsync clone]

Imagine that only "git-svn clone" and "svnsync clone" are made available
to external users. Furthur, "git-svn clone" contains only trunk, and for
reasons unknown, "svnsync clone" is missing the revision properties that
normally provide the origin svn repo's UUID.

A git user who has cloned the "git-svn clone" repo now wishes to use
git-svn to pull in the missing branches from the "synsync clone" repo.
In order for git-svn to get the history correct for those branches,
it needs to know the origin svn repo's UUID. Hence rewriteUUID.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: update svn mergeinfo test suite
Andrew Myrick [Thu, 21 Jan 2010 21:55:48 +0000 (21:55 +0000)]
git-svn: update svn mergeinfo test suite

Add a partial branch (e.g., a branch from a project subdirectory) to the
git-svn mergeinfo test repository.

Add a tag and a branch from that tag to the git-svn mergeinfo test repository.

Update the test script to expect a known failure in git-svn exposed by these
additions where merge info for partial branches is not preserved.

Signed-off-by: Andrew Myrick <amyrick@apple.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: document --username/commit-url for branch/tag
Igor Mironov [Mon, 11 Jan 2010 16:22:27 +0000 (03:22 +1100)]
git-svn: document --username/commit-url for branch/tag

[ew: shortened subject]

Signed-off-by: Igor Mironov <igor.a.mironov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: add --username/commit-url options for branch/tag
Igor Mironov [Mon, 11 Jan 2010 16:21:51 +0000 (03:21 +1100)]
git-svn: add --username/commit-url options for branch/tag

Add ability to specify on the command line the username to perform the
operation as and the writable URL of the repository to perform it on.

[ew: shortened subject]

Signed-off-by: Igor Mironov <igor.a.mironov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: respect commiturl option for branch/tag
Igor Mironov [Mon, 11 Jan 2010 16:21:23 +0000 (03:21 +1100)]
git-svn: respect commiturl option for branch/tag

When constructing a destination URL, use the property 'commiturl' if it
is specified in the configuration file; otherwise take 'url' as usual.
This accommodates the scenario where a user only wants to involve the
writable repository in operations performing a commit and defaults
everything else to a read-only URL.

[ew: shortened subject]

Signed-off-by: Igor Mironov <igor.a.mironov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: fix mismatched src/dst errors for branch/tag
Igor Mironov [Mon, 11 Jan 2010 16:20:43 +0000 (03:20 +1100)]
git-svn: fix mismatched src/dst errors for branch/tag

This fixes the following issue:

$ git svn branch -t --username=svnuser \
  --commit-url=https://myproj.domain.com/svn mytag
Copying http://myproj.domain.com/svn/trunk at r26 to
https://myproj.domain.com/svn/tags/mytag...

Trying to use an unsupported feature: Source and dest appear not to be
in the same repository (src: 'http://myproj.domain.com/svn/trunk';
dst: 'https://myproj.domain.com/svn/tags/mytag')

[ew: shortened subject]

Signed-off-by: Igor Mironov <igor.a.mironov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: handle merge-base failures
Andrew Myrick [Thu, 7 Jan 2010 00:25:22 +0000 (16:25 -0800)]
git-svn: handle merge-base failures

Change git-svn to warn and continue when merge-base fails while processing svn
merge tickets.

merge-base can fail when a partial branch is created and merged back to trunk
in svn, because it cannot find a common ancestor between the partial branch and
trunk.

Signed-off-by: Andrew Myrick <amyrick@apple.com>
Acked-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: ignore changeless commits when checking for a cherry-pick
Andrew Myrick [Thu, 7 Jan 2010 00:25:21 +0000 (16:25 -0800)]
git-svn: ignore changeless commits when checking for a cherry-pick

Update git-svn to ignore commits that do not change the tree when it is
deciding if an svn merge ticket represents a real branch merge or just a
cherry-pick.

Consider the following integration model in the svn repository:

   F---G  branch1
  /     \
 D  tag1 \   E  tag2
/         \ /
A---B      C  trunk

branch1 is merged to trunk in commit C.

With this patch, git-svn will correctly identify branch1 as a proper merge
parent, instead of incorrectly ignoring it as a cherry-pick.

Signed-off-by: Andrew Myrick <amyrick@apple.com>
Acked-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agomsvc: Add a definition of NORETURN compatible with msvc compiler
Ramsay Jones [Wed, 20 Jan 2010 19:45:12 +0000 (19:45 +0000)]
msvc: Add a definition of NORETURN compatible with msvc compiler

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoUpdate draft release notes to 1.7.0
Junio C Hamano [Sat, 23 Jan 2010 00:34:50 +0000 (16:34 -0800)]
Update draft release notes to 1.7.0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomsvc: Fix a compiler warning due to an incorrect pointer cast
Ramsay Jones [Wed, 20 Jan 2010 19:34:14 +0000 (19:34 +0000)]
msvc: Fix a compiler warning due to an incorrect pointer cast

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomsvc: Fix an "unrecognized option" linker warning
Ramsay Jones [Wed, 20 Jan 2010 19:25:51 +0000 (19:25 +0000)]
msvc: Fix an "unrecognized option" linker warning

Having recently added support for building git-imap-send on
Windows, we now link against OpenSSL libraries, and the linker
issues the following warning:

    warning LNK4044: unrecognized option '/lssl'; ignored

In order to suppress the warning, we change the msvc linker
script to translate an '-lssl' parameter to the ssleay32.lib
library.

Note that the linker script was already including ssleay32.lib
(along with libeay32.lib) as part of the translation of the
'-lcrypto' library parameter.  However, libeay32.dll does not
depend on ssleay32.dll and can be used stand-alone, so we remove
ssleay32.lib from the '-lcrypto' translation.

The dependence of ssleay32.dll on libeay32.dll is represented in
the Makefile by the NEEDS_CRYPTO_WITH_SSL build variable.

Also, add the corresponding change to the buildsystem generator.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Sat, 23 Jan 2010 00:12:41 +0000 (16:12 -0800)]
Merge branch 'maint'

* maint:
  ignore duplicated slashes in make_relative_path()

14 years agoMerge branch 'jc/branch-d'
Junio C Hamano [Sat, 23 Jan 2010 00:08:19 +0000 (16:08 -0800)]
Merge branch 'jc/branch-d'

* jc/branch-d:
  branch -d: base the "already-merged" safety on the branch it merges with

14 years agoMerge branch 'il/rev-glob'
Junio C Hamano [Sat, 23 Jan 2010 00:08:16 +0000 (16:08 -0800)]
Merge branch 'il/rev-glob'

* il/rev-glob:
  Documentation: improve description of --glob=pattern and friends
  rev-parse --branches/--tags/--remotes=pattern
  rev-parse --glob

14 years agoMerge branch 'js/refer-upstream'
Junio C Hamano [Sat, 23 Jan 2010 00:08:13 +0000 (16:08 -0800)]
Merge branch 'js/refer-upstream'

* js/refer-upstream:
  Teach @{upstream} syntax to strbuf_branchanme()
  t1506: more test for @{upstream} syntax
  Introduce <branch>@{upstream} notation

14 years agoMerge branch 'jl/submodule-diff'
Junio C Hamano [Sat, 23 Jan 2010 00:08:10 +0000 (16:08 -0800)]
Merge branch 'jl/submodule-diff'

* jl/submodule-diff:
  Performance optimization for detection of modified submodules
  git status: Show uncommitted submodule changes too when enabled
  Teach diff that modified submodule directory is dirty
  Show submodules as modified when they contain a dirty work tree

14 years agoMerge branch 'il/remote-updates'
Junio C Hamano [Sat, 23 Jan 2010 00:08:07 +0000 (16:08 -0800)]
Merge branch 'il/remote-updates'

* il/remote-updates:
  Add git remote set-url

14 years agoMerge branch 'il/branch-set-upstream'
Junio C Hamano [Sat, 23 Jan 2010 00:08:05 +0000 (16:08 -0800)]
Merge branch 'il/branch-set-upstream'

* il/branch-set-upstream:
  branch: warn and refuse to set a branch as a tracking branch of itself.
  Add branch --set-upstream

14 years agoMerge branch 'jc/maint-limit-note-output'
Junio C Hamano [Sat, 23 Jan 2010 00:08:01 +0000 (16:08 -0800)]
Merge branch 'jc/maint-limit-note-output'

* jc/maint-limit-note-output:
  Fix "log --oneline" not to show notes
  Fix "log" family not to be too agressive about showing notes

14 years agoMerge branch 'nd/ls-files-sparse-fix'
Junio C Hamano [Sat, 23 Jan 2010 00:07:18 +0000 (16:07 -0800)]
Merge branch 'nd/ls-files-sparse-fix'

* nd/ls-files-sparse-fix:
  Fix memory corruption when .gitignore does not end by \n

14 years agoMake difftool.prompt fall back to mergetool.prompt
Sebastian Schuberth [Fri, 22 Jan 2010 16:36:36 +0000 (17:36 +0100)]
Make difftool.prompt fall back to mergetool.prompt

The documentation states that "git-difftool falls back to git-mergetool
config variables when the difftool equivalents have not been defined".
Until now, this was not the case for "difftool.prompt".

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoengine.pl: Fix a recent breakage of the buildsystem generator
Ramsay Jones [Fri, 22 Jan 2010 20:00:47 +0000 (20:00 +0000)]
engine.pl: Fix a recent breakage of the buildsystem generator

Commit ade2ca0c (Do not try to remove directories when removing
old links, 2009-10-27) added an expression to a 'test' using an
'-o' or connective. This resulted in the buildsystem generator
mistaking a conditional 'rm' for a linker command. In order to
fix the breakage, we filter out all 'test' commands before then
attempting to identify the commands of interest.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoignore duplicated slashes in make_relative_path()
Junio C Hamano [Fri, 22 Jan 2010 03:05:19 +0000 (19:05 -0800)]
ignore duplicated slashes in make_relative_path()

The function takes two paths, an early part of abs is supposed to match
base; otherwise abs is not a path under base and the function returns the
full path of abs.  The caller can easily confuse the implementation by
giving duplicated and needless slashes in these path arguments.

Credit for test script, motivation and initial patch goes to Thomas Rast.
A follow-up fix (squashed) is by Hannes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-mv: fix moving more than one source to a single destination
Junio C Hamano [Fri, 22 Jan 2010 22:17:06 +0000 (14:17 -0800)]
git-mv: fix moving more than one source to a single destination

The code used as if return value from basename(3) were stable, but
often the function is implemented to return a pointer to a static
storage internal to it.

Because basename(3) is also allowed to modify its input parameter in
place, casting constness away from the strings we obtained from the
caller and giving them to basename is a no-no.

Reported, and initial fix and test supplied by David Rydh.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorebase -i: Enclose sed command substitution in quotes
Michael Haggerty [Fri, 22 Jan 2010 09:22:30 +0000 (10:22 +0100)]
rebase -i: Enclose sed command substitution in quotes

Reported by: Johannes Sixt <j.sixt@viscovery.net>

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorebase -i: Avoid non-portable "test X -a Y"
Michael Haggerty [Fri, 22 Jan 2010 09:22:29 +0000 (10:22 +0100)]
rebase -i: Avoid non-portable "test X -a Y"

Reported by: Eric Blake <ebb9@byu.net>

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "index-pack" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:55:19 +0000 (07:55 -0800)]
make "index-pack" a built-in

This required some fairly trivial packfile function 'const' cleanup,
since the builtin commands get a const char *argv[] array.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "git pack-redundant" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:42:14 +0000 (07:42 -0800)]
make "git pack-redundant" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "git unpack-file" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:38:03 +0000 (07:38 -0800)]
make "git unpack-file" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "mktag" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:34:44 +0000 (07:34 -0800)]
make "mktag" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "merge-index" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:29:21 +0000 (07:29 -0800)]
make "merge-index" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge-tree: remove unnecessary call of git_extract_argv0_path
Johannes Sixt [Fri, 22 Jan 2010 11:47:59 +0000 (12:47 +0100)]
merge-tree: remove unnecessary call of git_extract_argv0_path

This call should have been removed when the utility was made a builtin by
907a7cb.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "git patch-id" a built-in
Linus Torvalds [Fri, 22 Jan 2010 04:31:25 +0000 (20:31 -0800)]
make "git patch-id" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "git var" a built-in
Linus Torvalds [Fri, 22 Jan 2010 04:21:55 +0000 (20:21 -0800)]
make "git var" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofix git-p4 editor invocation
Nicolas Pitre [Fri, 22 Jan 2010 05:55:15 +0000 (00:55 -0500)]
fix git-p4 editor invocation

The strip() is required to remove the trailing newline character,
as already done elsewhere.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: improve description of --glob=pattern and friends
Thomas Rast [Fri, 22 Jan 2010 00:21:38 +0000 (01:21 +0100)]
Documentation: improve description of --glob=pattern and friends

Consolidate the descriptions of --branches, --tags and --remotes a
bit, to make it less repetitive.  Improve the grammar a bit, and spell
out the meaning of the 'append /*' rule.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Fri, 22 Jan 2010 04:08:31 +0000 (20:08 -0800)]
Merge branch 'maint'

* maint:
  merge-recursive: do not return NULL only to cause segfault
  retry request without query when info/refs?query fails

14 years agomake "git hash-object" a built-in
Linus Torvalds [Fri, 22 Jan 2010 03:50:11 +0000 (19:50 -0800)]
make "git hash-object" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "git merge-tree" a built-in
Linus Torvalds [Fri, 22 Jan 2010 02:25:20 +0000 (18:25 -0800)]
make "git merge-tree" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoslim down "git show-index"
Linus Torvalds [Thu, 21 Jan 2010 23:25:19 +0000 (15:25 -0800)]
slim down "git show-index"

As the documentation says, this is primarily for debugging, and
in the longer term we should rename it to test-show-index or something.

In the meantime, just avoid xmalloc (which slurps in the rest of git), and
separating out the trivial hex functions into "hex.o".

This results in

  [torvalds@nehalem git]$ size git-show-index
       text    data     bss     dec     hex filename
     222818    2276  112688  337782   52776 git-show-index (before)
       5696     624    1264    7584    1da0 git-show-index (after)

which is a whole lot better.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoRemove diff machinery dependency from read-cache
Linus Torvalds [Thu, 21 Jan 2010 19:37:38 +0000 (11:37 -0800)]
Remove diff machinery dependency from read-cache

Exal Sibeaz pointed out that some git files are way too big, and that
add_files_to_cache() brings in all the diff machinery to any git binary
that needs the basic git SHA1 object operations from read-cache.c. Which
is pretty much all of them.

It's doubly silly, since add_files_to_cache() is only used by builtin
programs (add, checkout and commit), so it's fairly easily fixed by just
moving the thing to builtin-add.c, and avoiding the dependency entirely.

I initially argued to Exal that it would probably be best to try to depend
on smart compilers and linkers, but after spending some time trying to
make -ffunction-sections work and giving up, I think Exal was right, and
the fix is to just do some trivial cleanups like this.

This trivial cleanup results in pretty stunning file size differences.
The diff machinery really is mostly used by just the builtin programs, and
you have things like these trivial before-and-after numbers:

  -rwxr-xr-x 1 torvalds torvalds 1727420 2010-01-21 10:53 git-hash-object
  -rwxrwxr-x 1 torvalds torvalds  940265 2010-01-21 11:16 git-hash-object

Now, I'm not saying that 940kB is good either, but that's mostly all the
debug information - you can see the real code with 'size':

   text    data     bss     dec     hex filename
 418675    3920  127408  550003   86473 git-hash-object (before)
 230650    2288  111728  344666   5425a git-hash-object (after)

ie we have a nice 24% size reduction from this trivial cleanup.

It's not just that one file either. I get:

[torvalds@nehalem git]$ du -s /home/torvalds/libexec/git-core
45640 /home/torvalds/libexec/git-core (before)
33508 /home/torvalds/libexec/git-core (after)

so we're talking 12MB of diskspace here.

(Of course, stripping all the binaries brings the 33MB down to 9MB, so the
whole debug information thing is still the bulk of it all, but that's a
separate issue entirely)

Now, I'm sure there are other things we should do, and changing our
compiler flags from -O2 to -Os would bring the text size down by an
additional almost 20%, but this thing Exal pointed out seems to be some
good low-hanging fruit.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge-recursive: do not return NULL only to cause segfault
Junio C Hamano [Fri, 22 Jan 2010 00:38:56 +0000 (16:38 -0800)]
merge-recursive: do not return NULL only to cause segfault

merge-recursive calls write_tree_from_memory() to come up with a virtual
tree, with possible conflict markers inside the blob contents, while
merging multiple common ancestors down.  It is a bug to call the function
with unmerged entries in the index, even if the merge to come up with the
common ancestor resulted in conflicts.  Otherwise the result won't be
expressible as a tree object.

We _might_ want to suggest the user to set GIT_MERGE_VERBOSITY to 5 and
re-run the merge in the message.  At least we will know which part of
process_renames() or process_entry() functions is not correctly handling
the unmerged paths, and it might help us diagnosing the issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-rebase.txt: Fix spelling
Horst H. von Brand [Thu, 21 Jan 2010 20:34:25 +0000 (17:34 -0300)]
git-rebase.txt: Fix spelling

Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoretry request without query when info/refs?query fails
Tay Ray Chuan [Thu, 21 Jan 2010 14:41:00 +0000 (22:41 +0800)]
retry request without query when info/refs?query fails

When "info/refs" is a static file and not behind a CGI handler, some
servers may not handle a GET request for it with a query string
appended (eg. "?foo=bar") properly.

If such a request fails, retry it sans the query string. In addition,
ensure that the "smart" http protocol is not used (a service has to be
specified with "?service=<service name>" to be conformant).

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Reported-and-tested-by: Yaroslav Halchenko <debian@onerussian.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoFix "log --oneline" not to show notes
Junio C Hamano [Thu, 21 Jan 2010 22:57:41 +0000 (14:57 -0800)]
Fix "log --oneline" not to show notes

This option should be treated pretty much the same as --format="%h %s".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMake 'rerere forget' work from a subdirectory.
Johannes Sixt [Thu, 21 Jan 2010 08:23:48 +0000 (09:23 +0100)]
Make 'rerere forget' work from a subdirectory.

It forgot to apply the prefix to the paths given on the command line.

[jc: added test]

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMake test case numbers unique
Johannes Sixt [Thu, 21 Jan 2010 07:57:03 +0000 (08:57 +0100)]
Make test case numbers unique

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoconflict-marker-size: add test and docs
Junio C Hamano [Thu, 21 Jan 2010 07:49:27 +0000 (23:49 -0800)]
conflict-marker-size: add test and docs

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoUpdate draft release notes to 1.7.0
Junio C Hamano [Thu, 21 Jan 2010 07:30:45 +0000 (23:30 -0800)]
Update draft release notes to 1.7.0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'bw/cvsimport'
Junio C Hamano [Thu, 21 Jan 2010 04:28:51 +0000 (20:28 -0800)]
Merge branch 'bw/cvsimport'

* bw/cvsimport:
  cvsimport: standarize system() calls to external git tools
  cvsimport: standarize open() calls to external git tools
  cvsimport: modernize callouts to git subcommands

14 years agoMerge branch 'jc/checkout-merge-base'
Junio C Hamano [Thu, 21 Jan 2010 04:28:51 +0000 (20:28 -0800)]
Merge branch 'jc/checkout-merge-base'

* jc/checkout-merge-base:
  Fix "checkout A..." synonym for "checkout A...HEAD" on Windows

14 years agoMerge branch 'ag/patch-header-verify'
Junio C Hamano [Thu, 21 Jan 2010 04:28:51 +0000 (20:28 -0800)]
Merge branch 'ag/patch-header-verify'

* ag/patch-header-verify:
  builtin-apply.c: fix the --- and +++ header filename consistency check

14 years agoMerge branch 'jc/conflict-marker-size'
Junio C Hamano [Thu, 21 Jan 2010 04:28:51 +0000 (20:28 -0800)]
Merge branch 'jc/conflict-marker-size'

* jc/conflict-marker-size:
  rerere: honor conflict-marker-size attribute
  rerere: prepare for customizable conflict marker length
  conflict-marker-size: new attribute
  rerere: use ll_merge() instead of using xdl_merge()
  merge-tree: use ll_merge() not xdl_merge()
  xdl_merge(): allow passing down marker_size in xmparam_t
  xdl_merge(): introduce xmparam_t for merge specific parameters
  git_attr(): fix function signature

Conflicts:
builtin-merge-file.c
ll-merge.c
xdiff/xdiff.h
xdiff/xmerge.c

14 years agoMerge branch 'ag/maint-apply-too-large-p'
Junio C Hamano [Thu, 21 Jan 2010 04:28:50 +0000 (20:28 -0800)]
Merge branch 'ag/maint-apply-too-large-p'

* ag/maint-apply-too-large-p:
  builtin-apply.c: Skip filenames without enough components

14 years agoMerge branch 'ap/merge-backend-opts'
Junio C Hamano [Thu, 21 Jan 2010 04:28:50 +0000 (20:28 -0800)]
Merge branch 'ap/merge-backend-opts'

* ap/merge-backend-opts:
  Document that merge strategies can now take their own options
  Extend merge-subtree tests to test -Xsubtree=dir.
  Make "subtree" part more orthogonal to the rest of merge-recursive.
  pull: Fix parsing of -X<option>
  Teach git-pull to pass -X<option> to git-merge
  git merge -X<option>
  git-merge-file --ours, --theirs

Conflicts:
git-compat-util.h

14 years agoMerge branch 'nd/status-partial-refresh'
Junio C Hamano [Thu, 21 Jan 2010 04:28:50 +0000 (20:28 -0800)]
Merge branch 'nd/status-partial-refresh'

* nd/status-partial-refresh:
  rm: only refresh entries that we may touch
  status: only touch path we may need to check

14 years agoMerge remote branch 'remotes/trast-doc/for-next'
Junio C Hamano [Thu, 21 Jan 2010 04:28:49 +0000 (20:28 -0800)]
Merge remote branch 'remotes/trast-doc/for-next'

* remotes/trast-doc/for-next:
  Documentation: spell 'git cmd' without dash throughout
  Documentation: format full commands in typewriter font
  Documentation: warn prominently against merging with dirty trees
  Documentation/git-merge: reword references to "remote" and "pull"

Conflicts:
Documentation/config.txt
Documentation/git-config.txt
Documentation/git-merge.txt

14 years agoMerge branch 'jh/notes' (early part)
Junio C Hamano [Thu, 21 Jan 2010 04:28:49 +0000 (20:28 -0800)]
Merge branch 'jh/notes' (early part)

* 'jh/notes' (early part):
  Add more testcases to test fast-import of notes
  Rename t9301 to t9350, to make room for more fast-import tests
  fast-import: Proper notes tree manipulation

14 years agoMerge branch 'maint'
Junio C Hamano [Thu, 21 Jan 2010 04:28:39 +0000 (20:28 -0800)]
Merge branch 'maint'

* maint:
  status: don't require the repository to be writable

Conflicts:
builtin-commit.c

14 years agoMerge branch 'jc/maint-refresh-index-is-optional-for-status' into maint
Junio C Hamano [Thu, 21 Jan 2010 04:25:11 +0000 (20:25 -0800)]
Merge branch 'jc/maint-refresh-index-is-optional-for-status' into maint

* jc/maint-refresh-index-is-optional-for-status:
  status: don't require the repository to be writable

14 years agoFix memory corruption when .gitignore does not end by \n
Nguyễn Thái Ngọc Duy [Wed, 20 Jan 2010 14:09:16 +0000 (21:09 +0700)]
Fix memory corruption when .gitignore does not end by \n

Commit b5041c5 (Avoid writing to buffer in add_excludes_from_file_1())
tried not to append '\n' at the end because the next commit
may return a buffer that does not have extra space for that.

Unfortunately it left this assignment in the loop:

  buf[i - (i && buf[i-1] == '\r')] = 0;

that can corrupt memory if "buf" is not '\n' terminated. But even if
it does not corrupt memory, the last line would not be
NULL-terminated, leading to errors later inside add_exclude().

This patch fixes it by reverting the faulty commit and make
sure "buf" is always \n terminated.

While at it, free unused memory properly.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoFix "log" family not to be too agressive about showing notes
Junio C Hamano [Wed, 20 Jan 2010 21:59:36 +0000 (13:59 -0800)]
Fix "log" family not to be too agressive about showing notes

Giving "Notes" information in the default output format of "log" and
"show" is a sensible progress (the user has asked for it by having the
notes), but for some commands (e.g. "format-patch") spewing notes into the
formatted commit log message without being asked is too aggressive.

Enable notes output only for "log", "show", "whatchanged" by default and
only when the user didn't ask any specific --pretty/--format from the
command line; users can explicitly override this default with --show-notes
and --no-notes option.

Parts of tests are taken from Jeff King's fix.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'rr/core-tutorial'
Junio C Hamano [Wed, 20 Jan 2010 23:24:42 +0000 (15:24 -0800)]
Merge branch 'rr/core-tutorial'

* rr/core-tutorial:
  Documentation: Update git core tutorial clarifying reference to scripts

14 years agoMerge branch 'jc/cache-unmerge'
Junio C Hamano [Wed, 20 Jan 2010 22:44:31 +0000 (14:44 -0800)]
Merge branch 'jc/cache-unmerge'

* jc/cache-unmerge:
  rerere forget path: forget recorded resolution
  rerere: refactor rerere logic to make it independent from I/O
  rerere: remove silly 1024-byte line limit
  resolve-undo: teach "update-index --unresolve" to use resolve-undo info
  resolve-undo: "checkout -m path" uses resolve-undo information
  resolve-undo: allow plumbing to clear the information
  resolve-undo: basic tests
  resolve-undo: record resolved conflicts in a new index extension section
  builtin-merge.c: use standard active_cache macros

Conflicts:
builtin-ls-files.c
builtin-merge.c
builtin-rerere.c

14 years agoMerge branch 'js/exec-error-report'
Junio C Hamano [Wed, 20 Jan 2010 22:44:12 +0000 (14:44 -0800)]
Merge branch 'js/exec-error-report'

* js/exec-error-report:
  Improve error message when a transport helper was not found
  start_command: detect execvp failures early
  run-command: move wait_or_whine earlier
  start_command: report child process setup errors to the parent's stderr

Conflicts:
Makefile

14 years agoMerge branch 'jc/ls-files-ignored-pathspec'
Junio C Hamano [Wed, 20 Jan 2010 22:43:54 +0000 (14:43 -0800)]
Merge branch 'jc/ls-files-ignored-pathspec'

* jc/ls-files-ignored-pathspec:
  ls-files: fix overeager pathspec optimization
  read_directory(): further split treat_path()
  read_directory_recursive(): refactor handling of a single path into a separate function
  t3001: test ls-files -o ignored/dir

14 years agoMerge branch 'jc/grep-lookahead'
Junio C Hamano [Wed, 20 Jan 2010 22:43:41 +0000 (14:43 -0800)]
Merge branch 'jc/grep-lookahead'

* jc/grep-lookahead:
  grep --no-index: allow use of "git grep" outside a git repository
  grep: prepare to run outside of a work tree
  grep: rip out pessimization to use fixmatch()
  grep: rip out support for external grep
  grep: optimize built-in grep by skipping lines that do not hit

Conflicts:
builtin-grep.c
t/t7002-grep.sh

14 years agoMerge branch 'jc/maint-strbuf-add-fix-doubling'
Junio C Hamano [Wed, 20 Jan 2010 22:43:09 +0000 (14:43 -0800)]
Merge branch 'jc/maint-strbuf-add-fix-doubling'

* jc/maint-strbuf-add-fix-doubling:
  strbuf_addbuf(): allow passing the same buf to dst and src

14 years agoMerge branch 'mm/conflict-advice'
Junio C Hamano [Wed, 20 Jan 2010 22:42:59 +0000 (14:42 -0800)]
Merge branch 'mm/conflict-advice'

* mm/conflict-advice:
  Be more user-friendly when refusing to do something because of conflict.

Conflicts:
Documentation/config.txt
advice.c
advice.h

14 years agoMerge branch 'da/difftool'
Junio C Hamano [Wed, 20 Jan 2010 22:42:20 +0000 (14:42 -0800)]
Merge branch 'da/difftool'

* da/difftool:
  difftool: Update copyright notices to list each year separately
  difftool: Use eval to expand '--extcmd' expressions
  difftool: Add '-x' and as an alias for '--extcmd'
  t7800-difftool.sh: Simplify the --extcmd test
  git-diff.txt: Link to git-difftool
  difftool: Allow specifying unconfigured commands with --extcmd
  difftool--helper: Remove use of the GIT_MERGE_TOOL variable
  difftool--helper: Update copyright and remove distracting comments
  git-difftool: Add '--gui' for selecting a GUI tool
  t7800-difftool: Set a bogus tool for use by tests

14 years agoMerge branch 'mh/rebase-fixup'
Junio C Hamano [Wed, 20 Jan 2010 22:42:07 +0000 (14:42 -0800)]
Merge branch 'mh/rebase-fixup'

* mh/rebase-fixup:
  rebase -i: Retain user-edited commit messages after squash/fixup conflicts
  t3404: Set up more of the test repo in the "setup" step
  rebase -i: For fixup commands without squashes, do not start editor
  rebase -i: Change function make_squash_message into update_squash_message
  rebase -i: Extract function do_with_author
  rebase -i: Handle the author script all in one place in do_next
  rebase -i: Extract a function "commit_message"
  rebase -i: Simplify commit counting for generated commit messages
  rebase -i: Improve consistency of commit count in generated commit messages
  t3404: Test the commit count in commit messages generated by "rebase -i"
  rebase -i: Introduce a constant AMEND
  rebase -i: Introduce a constant AUTHOR_SCRIPT
  rebase -i: Document how temporary files are used
  rebase -i: Use symbolic constant $MSG consistently
  rebase -i: Use "test -n" instead of "test ! -z"
  rebase -i: Inline expression
  rebase -i: Remove dead code
  rebase -i: Make the condition for an "if" more transparent

14 years agoMerge branch 'ns/rebase-auto-squash'
Junio C Hamano [Wed, 20 Jan 2010 22:42:04 +0000 (14:42 -0800)]
Merge branch 'ns/rebase-auto-squash'

* ns/rebase-auto-squash:
  rebase -i --autosquash: auto-squash commits

Conflicts:
git-rebase--interactive.sh

14 years agoMerge branch 'mh/rebase-fixup' (early part)
Junio C Hamano [Wed, 20 Jan 2010 22:41:48 +0000 (14:41 -0800)]
Merge branch 'mh/rebase-fixup' (early part)

* 'mh/rebase-fixup' (early part):
  rebase-i: Ignore comments and blank lines in peek_next_command
  lib-rebase: Allow comments and blank lines to be added to the rebase script
  lib-rebase: Provide clearer debugging info about what the editor did
  Add a command "fixup" to rebase --interactive
  t3404: Use test_commit to set up test repository

14 years agoMerge branch 'il/push-set-upstream'
Junio C Hamano [Wed, 20 Jan 2010 22:40:48 +0000 (14:40 -0800)]
Merge branch 'il/push-set-upstream'

* il/push-set-upstream:
  Add push --set-upstream

Conflicts:
transport.c

14 years agoMerge branch 'jk/warn-author-committer-after-commit'
Junio C Hamano [Wed, 20 Jan 2010 22:40:12 +0000 (14:40 -0800)]
Merge branch 'jk/warn-author-committer-after-commit'

* jk/warn-author-committer-after-commit:
  user_ident_sufficiently_given(): refactor the logic to be usable from elsewhere
  commit.c::print_summary: do not release the format string too early
  commit: allow suppression of implicit identity advice
  commit: show interesting ident information in summary
  strbuf: add strbuf_addbuf_percentquote
  strbuf_expand: convert "%%" to "%"

Conflicts:
builtin-commit.c
ident.c

14 years agoMerge branch 'jc/ident'
Junio C Hamano [Wed, 20 Jan 2010 22:39:52 +0000 (14:39 -0800)]
Merge branch 'jc/ident'

* jc/ident:
  ident.c: replace fprintf with fputs to suppress compiler warning
  user_ident_sufficiently_given(): refactor the logic to be usable from elsewhere
  ident.c: treat $EMAIL as giving user.email identity explicitly
  ident.c: check explicit identity for name and email separately
  ident.c: remove unused variables

14 years agoMerge branch 'tr/http-push-ref-status'
Junio C Hamano [Wed, 20 Jan 2010 22:39:48 +0000 (14:39 -0800)]
Merge branch 'tr/http-push-ref-status'

* tr/http-push-ref-status:
  transport-helper.c::push_refs(): emit "no refs" error message
  transport-helper.c::push_refs(): ignore helper-reported status if ref is not to be pushed
  transport.c::transport_push(): make ref status affect return value
  refactor ref status logic for pushing
  t5541-http-push.sh: add test for unmatched, non-fast-forwarded refs
  t5541-http-push.sh: add tests for non-fast-forward pushes

Conflicts:
transport-helper.c

14 years agoMerge branch 'bk/fix-relative-gitdir-file'
Junio C Hamano [Wed, 20 Jan 2010 22:38:34 +0000 (14:38 -0800)]
Merge branch 'bk/fix-relative-gitdir-file'

* bk/fix-relative-gitdir-file:
  Handle relative paths in submodule .git files
  Test update-index for a gitlink to a .git file

14 years agoMerge branch 'sd/cd-p-show-toplevel'
Junio C Hamano [Wed, 20 Jan 2010 22:38:30 +0000 (14:38 -0800)]
Merge branch 'sd/cd-p-show-toplevel'

* sd/cd-p-show-toplevel:
  Use $(git rev-parse --show-toplevel) in cd_to_toplevel().
  Add 'git rev-parse --show-toplevel' option.

14 years agoMerge branch 'jc/symbol-static'
Junio C Hamano [Wed, 20 Jan 2010 22:37:25 +0000 (14:37 -0800)]
Merge branch 'jc/symbol-static'

* jc/symbol-static:
  date.c: mark file-local function static
  Replace parse_blob() with an explanatory comment
  symlinks.c: remove unused functions
  object.c: remove unused functions
  strbuf.c: remove unused function
  sha1_file.c: remove unused function
  mailmap.c: remove unused function
  utf8.c: mark file-local function static
  submodule.c: mark file-local function static
  quote.c: mark file-local function static
  remote-curl.c: mark file-local function static
  read-cache.c: mark file-local functions static
  parse-options.c: mark file-local function static
  entry.c: mark file-local function static
  http.c: mark file-local functions static
  pretty.c: mark file-local function static
  builtin-rev-list.c: mark file-local function static
  bisect.c: mark file-local function static

14 years agodate.c: mark file-local function static
Junio C Hamano [Tue, 12 Jan 2010 07:52:47 +0000 (23:52 -0800)]
date.c: mark file-local function static

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoSync with 1.6.6.1
Junio C Hamano [Wed, 20 Jan 2010 22:01:28 +0000 (14:01 -0800)]
Sync with 1.6.6.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGit 1.6.6.1 v1.6.6.1
Junio C Hamano [Wed, 20 Jan 2010 21:29:21 +0000 (13:29 -0800)]
Git 1.6.6.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'bg/maint-remote-update-default' into maint
Junio C Hamano [Wed, 20 Jan 2010 21:23:59 +0000 (13:23 -0800)]
Merge branch 'bg/maint-remote-update-default' into maint

* bg/maint-remote-update-default:
  Fix "git remote update" with remotes.defalt set

14 years agoMerge branch 'sb/maint-octopus' into maint
Junio C Hamano [Wed, 20 Jan 2010 21:02:24 +0000 (13:02 -0800)]
Merge branch 'sb/maint-octopus' into maint

* sb/maint-octopus:
  octopus: remove dead code
  octopus: reenable fast-forward merges
  octopus: make merge process simpler to follow

Conflicts:
git-merge-octopus.sh

14 years agoMerge branch 'bg/maint-add-all-doc' into maint
Junio C Hamano [Wed, 20 Jan 2010 21:01:33 +0000 (13:01 -0800)]
Merge branch 'bg/maint-add-all-doc' into maint

* bg/maint-add-all-doc:
  git-rm doc: Describe how to sync index & work tree
  git-add/rm doc: Consistently back-quote
  Documentation: 'git add -A' can remove files

14 years agoMerge branch 'maint-1.6.5' into maint
Junio C Hamano [Wed, 20 Jan 2010 21:01:19 +0000 (13:01 -0800)]
Merge branch 'maint-1.6.5' into maint

* maint-1.6.5:
  Git 1.6.5.8
  Fix mis-backport of t7002
  bash completion: factor submodules into dirty state
  reset: unbreak hard resets with GIT_WORK_TREE

Conflicts:
Documentation/git.txt
GIT-VERSION-GEN
RelNotes

14 years agoGit 1.6.5.8 v1.6.5.8
Junio C Hamano [Wed, 20 Jan 2010 20:44:59 +0000 (12:44 -0800)]
Git 1.6.5.8

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorev-parse --branches/--tags/--remotes=pattern
Ilari Liusvaara [Wed, 20 Jan 2010 09:48:26 +0000 (11:48 +0200)]
rev-parse --branches/--tags/--remotes=pattern

Since local branch, tags and remote tracking branch namespaces are
most often used, add shortcut notations for globbing those in
manner similar to --glob option.

With this, one can express the "what I have but origin doesn't?"
as:

'git log --branches --not --remotes=origin'

Original-idea-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorev-parse --glob
Ilari Liusvaara [Wed, 20 Jan 2010 09:48:25 +0000 (11:48 +0200)]
rev-parse --glob

Add --glob=<glob-pattern> option to rev-parse and everything that
accepts its options. This option matches all refs that match given
shell glob pattern (complete with some DWIM logic).

Example:

'git log --branches --not --glob=remotes/origin'

To show what you have that origin doesn't.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'jk/maint-1.6.5-reset-hard' into maint-1.6.5
Junio C Hamano [Wed, 20 Jan 2010 20:22:58 +0000 (12:22 -0800)]
Merge branch 'jk/maint-1.6.5-reset-hard' into maint-1.6.5

* jk/maint-1.6.5-reset-hard:
  reset: unbreak hard resets with GIT_WORK_TREE

14 years agoMerge branch 'tr/maint-1.6.5-bash-prompt-show-submodule-changes' into maint-1.6.5
Junio C Hamano [Wed, 20 Jan 2010 20:22:54 +0000 (12:22 -0800)]
Merge branch 'tr/maint-1.6.5-bash-prompt-show-submodule-changes' into maint-1.6.5

* tr/maint-1.6.5-bash-prompt-show-submodule-changes:
  bash completion: factor submodules into dirty state

14 years agoMerge branch 'dp/maint-1.6.5-fast-import-non-commit-tag' into maint-1.6.5
Junio C Hamano [Wed, 20 Jan 2010 20:17:24 +0000 (12:17 -0800)]
Merge branch 'dp/maint-1.6.5-fast-import-non-commit-tag' into maint-1.6.5

* dp/maint-1.6.5-fast-import-non-commit-tag:
  fast-import: tag may point to any object type

14 years agoMerge branch 'jm/maint-1.6.5-grep-NUL-terminate' into maint-1.6.5
Junio C Hamano [Wed, 20 Jan 2010 20:16:46 +0000 (12:16 -0800)]
Merge branch 'jm/maint-1.6.5-grep-NUL-terminate' into maint-1.6.5

* jm/maint-1.6.5-grep-NUL-terminate:
  grep: NUL terminate input from a file

14 years agoTeach @{upstream} syntax to strbuf_branchanme()
Junio C Hamano [Wed, 20 Jan 2010 07:17:11 +0000 (23:17 -0800)]
Teach @{upstream} syntax to strbuf_branchanme()

This teaches @{upstream} syntax to interpret_branch_name(), instead
of dwim_ref() machinery.

There are places in git UI that behaves differently when you give a local
branch name and when you give an extended SHA-1 expression that evaluates
to the commit object name at the tip of the branch.  The intent is that
the special syntax such as @{-1} can stand in as if the user spelled the
name of the branch in such places.

The name of the branch "frotz" to switch to ("git checkout frotz"), and
the name of the branch "nitfol" to fork a new branch "frotz" from ("git
checkout -b frotz nitfol"), are examples of such places.  These places
take only the name of the branch (e.g. "frotz"), and they are supposed to
act differently to an equivalent refname (e.g. "refs/heads/frotz"), so
hooking the @{upstream} and @{-N} syntax to dwim_ref() is insufficient
when we want to deal with cases a local branch is forked from another
local branch and use "forked@{upstream}" to name the forkee branch.

The "upstream" syntax "forked@{u}" is to specify the ref that "forked" is
configured to merge with, and most often the forkee is a remote tracking
branch, not a local branch.  We cannot simply return a local branch name,
but that does not necessarily mean we have to returns the full refname
(e.g. refs/remotes/origin/frotz, when returning origin/frotz is enough).
This update calls shorten_unambiguous_ref() to do so.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot1506: more test for @{upstream} syntax
Junio C Hamano [Wed, 20 Jan 2010 09:08:48 +0000 (01:08 -0800)]
t1506: more test for @{upstream} syntax

This adds a few more tests that exercises @{upstream} syntax by commands
that operate differently when they are given branch name as opposed to a
refname (i.e. where "master" and "refs/heads/master" makes a difference).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoFix "checkout A..." synonym for "checkout A...HEAD" on Windows
Junio C Hamano [Wed, 20 Jan 2010 03:30:06 +0000 (19:30 -0800)]
Fix "checkout A..." synonym for "checkout A...HEAD" on Windows

When switching to a different commit, we first see the named rev exists
as a commit using lookup_commit_reference_gently(), and set new.path to
a string "refs/heads/" followed by the name the user gave us (but after
taking into special short-hands like @{-1} == "previous branch" and
"@{upstream}" == "the branch we merge with" into account).  If the
resulting string names an existsing ref, then we are switching to that
branch (and will be building new commits on top of it); otherwise we are
detaching HEAD at that commit.

When the "master..." syntax is used as a short-hand for "master...HEAD",
we do want to detach HEAD at the merge base.  However, on Windows, when
asked if ".git/refs/heads/master..." exists, the filesystem happily says
"it does" when ".git/refs/heads/master" exists.

Work this issue around by first calling check_ref_format(new.path) to see
if the string can possibly be a valid ref under "refs/heads/", before
asking resolve_ref().

We used to run another lookup_commit_reference(rev) even though we know it
succeeded and we have a good commit in new.commit already; this has been
with us from 782c2d6 (Build in checkout, 2008-02-07), the first version we
had "git checkout" implemented in C.  Drop it.

Noticed by Alex Riesen.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agostatus: don't require the repository to be writable
Junio C Hamano [Wed, 20 Jan 2010 01:10:35 +0000 (17:10 -0800)]
status: don't require the repository to be writable

We need to update the index before hooks run when actually making a
commit, but we shouldn't have to write the index when running "status".
If we can, then we have already spent cycles to refresh the index and
it is a waste not to write it out, but it is not a disaster if we cannot
write it out.  The main reason the user is running "git status" is to get
the "status", and refreshing the index is a mere side effect that we can
do without.

Discovery and initial attempted fix by Dscho.

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