Code

git.git
13 years agoMerge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix' into maint-1.7.4
Junio C Hamano [Thu, 26 May 2011 17:27:55 +0000 (10:27 -0700)]
Merge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix' into maint-1.7.4

* js/maint-send-pack-stateless-rpc-deadlock-fix:
  sideband_demux(): fix decl-after-stmt
  send-pack: unbreak push over stateless rpc
  send-pack: avoid deadlock when pack-object dies early

13 years agoMerge branch 'jk/maint-upload-pack-shallow' into maint-1.7.4
Junio C Hamano [Thu, 26 May 2011 17:27:29 +0000 (10:27 -0700)]
Merge branch 'jk/maint-upload-pack-shallow' into maint-1.7.4

* jk/maint-upload-pack-shallow:
  upload-pack: start pack-objects before async rev-list

13 years agoMerge branch 'js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix' into js/maint...
Junio C Hamano [Tue, 17 May 2011 00:01:03 +0000 (17:01 -0700)]
Merge branch 'js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix' into js/maint-send-pack-stateless-rpc-deadlock-fix

* js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix:
  sideband_demux(): fix decl-after-stmt

13 years agosideband_demux(): fix decl-after-stmt
Junio C Hamano [Mon, 16 May 2011 23:19:49 +0000 (16:19 -0700)]
sideband_demux(): fix decl-after-stmt

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix' into js/maint...
Junio C Hamano [Thu, 5 May 2011 20:46:36 +0000 (13:46 -0700)]
Merge branch 'js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix' into js/maint-send-pack-stateless-rpc-deadlock-fix

* js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix:
  send-pack: unbreak push over stateless rpc

13 years agosend-pack: unbreak push over stateless rpc
Jeff King [Thu, 5 May 2011 06:18:45 +0000 (02:18 -0400)]
send-pack: unbreak push over stateless rpc

Commit 09c9957 (send-pack: avoid deadlock when pack-object
dies early, 2011-04-25) attempted to fix a hang in the
stateless rpc case by closing a file descriptor early, but
we still need that descriptor.

Basically the deadlock can happen when pack-objects fails,
and the descriptor to upstream is left open. We never send
the pack, so the upstream is left waiting for us to say
something, and we are left waiting for upstream to close the
connection.

In the non-rpc case, our descriptor points straight to the
upstream. We hand it off to run-command, which takes
ownership and closes the descriptor after pack-objects
finishes (whether it succeeds or not).

Commit 09c9957 tried to emulate that in the rpc case. That
isn't right, though. We actually have a descriptor going
back to the remote-helper, and we need to keep using it
after pack-objects is finished. Closing it early completely
breaks pushing via smart-http.

We still need to do something on error to signal the
remote-helper that we won't be sending any pack data
(otherwise we get the deadlock).  In an ideal world, we
would send a special packet back that says "Sorry, there was
an error". But the remote-helper doesn't understand any such
packet, so the best we can do is close the descriptor and
let it report that we hung up unexpectedly.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix' into js/maint...
Junio C Hamano [Mon, 25 Apr 2011 22:20:39 +0000 (15:20 -0700)]
Merge branch 'js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix' into js/maint-send-pack-stateless-rpc-deadlock-fix

* js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix:
  send-pack: avoid deadlock when pack-object dies early

Evil merge to adjust the way the use of pthreads in sideband-demultiplexor
was decided (earlier it was "if we are not on Windows", now it is "if we
are not using pthreads").

13 years agosend-pack: avoid deadlock when pack-object dies early
Johannes Sixt [Mon, 25 Apr 2011 21:04:10 +0000 (23:04 +0200)]
send-pack: avoid deadlock when pack-object dies early

Send-pack deadlocks in two ways when pack-object dies early (for example,
because there is some repo corruption).

The first deadlock happens with the smart push protocol (--stateless-rpc).
After the initial rev-exchange, the remote is waiting for the pack data
to arrive, and the sideband demuxer at the local side continues trying to
stream data from the remote repository until it gets EOF. Meanwhile,
send-pack (in function pack_objects()) has noticed that pack-objects did
not produce output and died. Back in send_pack(), it now tries to clean
up the sideband demuxer using finish_async(). The demuxer, however, waits
for the remote end to close down, the remote waits for pack data, and
the reason that it still waits is that send-pack forgot to close the
outgoing channel. Add the missing close() in pack_objects().

The second deadlock happens in a similar constellation when the sideband
demuxer runs in a forked process (rather than in a thread). Again, the
remote end waits for pack data to arrive, the sideband demuxer waits for
the remote to shut down, and send-pack (in the regular clean-up) waits for
the demuxer to terminate. This time, the send-pack parent process closes
the writable end of the outgoing channel (in start_command() that spawned
pack-objects) so that after the death of the pack-objects process all
writable ends should have been closed and the remote repo should see EOF.
This does not happen, however, because when the sideband demuxer was forked
earlier, it also inherited a writable end; it remains open and keeps the
remote repo from seeing EOF. To break this deadlock, close the writable end
in the demuxer.

Analyzed-by: Jeff King <peff@peff.net>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.4.5 v1.7.4.5
Junio C Hamano [Tue, 19 Apr 2011 18:45:38 +0000 (11:45 -0700)]
Git 1.7.4.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-svn.txt: Document --mergeinfo
Michael J Gruber [Tue, 19 Apr 2011 12:24:27 +0000 (14:24 +0200)]
git-svn.txt: Document --mergeinfo

6abd933 (git-svn: allow the mergeinfo property to be set, 2010-09-24)
introduced the --mergeinfo option. Document it.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoarchive: document limitation of tar.umask config setting
René Scharfe [Thu, 14 Apr 2011 18:04:57 +0000 (20:04 +0200)]
archive: document limitation of tar.umask config setting

The local value of the config variable tar.umask is not passed to the
other side with --remote.  We may want to change that, but for now just
document this fact.

Reported-by: Jacek Masiulaniec <jacek.masiulaniec@gmail.com>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot3306,t5304: avoid clock skew issues
Michael J Gruber [Thu, 14 Apr 2011 17:38:13 +0000 (19:38 +0200)]
t3306,t5304: avoid clock skew issues

On systems where the local time and file modification time may be out of
sync (e.g. test directory on NFS) t3306 and t5305 can fail because prune
compares times such as "now" (client time) with file modification times
(server times for remote file systems). I.e., these are spurious test
failures.

Avoid this by setting the relevant modification times to the local time.

Noticed on a system with as little as 2s time skew.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit.txt: fix list continuation
Michael J Gruber [Thu, 14 Apr 2011 07:17:26 +0000 (09:17 +0200)]
git.txt: fix list continuation

Remove a spurious empty line which prevented asciidoc from recognizing a
list continuation mark ('+'), so that it does not get output literally any
more.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/rev-list-options-fix' into maint
Junio C Hamano [Wed, 13 Apr 2011 20:56:52 +0000 (13:56 -0700)]
Merge branch 'jc/rev-list-options-fix' into maint

* jc/rev-list-options-fix:
  "log --cherry-pick" documentation regression fix

13 years agoMerge branch 'js/checkout-untracked-symlink' into maint
Junio C Hamano [Wed, 13 Apr 2011 20:55:53 +0000 (13:55 -0700)]
Merge branch 'js/checkout-untracked-symlink' into maint

* js/checkout-untracked-symlink:
  t2021: mark a test as fixed

13 years agot2021: mark a test as fixed
Johannes Sixt [Tue, 12 Apr 2011 06:41:19 +0000 (08:41 +0200)]
t2021: mark a test as fixed

The failure was fixed by the previous commit.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoupload-pack: start pack-objects before async rev-list
Jeff King [Wed, 6 Apr 2011 21:33:33 +0000 (17:33 -0400)]
upload-pack: start pack-objects before async rev-list

In a pthread-enabled version of upload-pack, there's a race condition
that can cause a deadlock on the fflush(NULL) we call from run-command.

What happens is this:

  1. Upload-pack is informed we are doing a shallow clone.

  2. We call start_async() to spawn a thread that will generate rev-list
     results to feed to pack-objects. It gets a file descriptor to a
     pipe which will eventually hook to pack-objects.

  3. The rev-list thread uses fdopen to create a new output stream
     around the fd we gave it, called pack_pipe.

  4. The thread writes results to pack_pipe. Outside of our control,
     libc is doing locking on the stream. We keep writing until the OS
     pipe buffer is full, and then we block in write(), still holding
     the lock.

  5. The main thread now uses start_command to spawn pack-objects.
     Before forking, it calls fflush(NULL) to flush every stdio output
     buffer. It blocks trying to get the lock on pack_pipe.

And we have a deadlock. The thread will block until somebody starts
reading from the pipe. But nobody will read from the pipe until we
finish flushing to the pipe.

To fix this, we swap the start order: we start the
pack-objects reader first, and then the rev-list writer
after. Thus the problematic fflush(NULL) happens before we
even open the new file descriptor (and even if it didn't,
flushing should no longer block, as the reader at the end of
the pipe is now active).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.4.4 v1.7.4.4
Junio C Hamano [Wed, 6 Apr 2011 17:49:35 +0000 (10:49 -0700)]
Git 1.7.4.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'nm/maint-conflicted-submodule-entries' into maint
Junio C Hamano [Wed, 6 Apr 2011 17:41:17 +0000 (10:41 -0700)]
Merge branch 'nm/maint-conflicted-submodule-entries' into maint

* nm/maint-conflicted-submodule-entries:
  submodule: process conflicting submodules only once

13 years agoMerge branch 'mg/rev-list-n-reverse-doc' into maint
Junio C Hamano [Wed, 6 Apr 2011 17:40:49 +0000 (10:40 -0700)]
Merge branch 'mg/rev-list-n-reverse-doc' into maint

* mg/rev-list-n-reverse-doc:
  git-log.txt,rev-list-options.txt: put option blocks in proper order
  git-log.txt,rev-list-options.txt: -n/--max-count is commit limiting

13 years agoDocumentation: trivial grammar fix in core.worktree description
SZEDER Gábor [Mon, 4 Apr 2011 14:59:25 +0000 (16:59 +0200)]
Documentation: trivial grammar fix in core.worktree description

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Fix parsing of negative fractional timezones in JavaScript
Jakub Narebski [Fri, 1 Apr 2011 19:06:28 +0000 (21:06 +0200)]
gitweb: Fix parsing of negative fractional timezones in JavaScript

Extract converting numerical timezone in the form of '(+|-)HHMM' to
timezoneOffset function, and fix parsing of negative fractional
timezones.

This is used to format timestamps in 'blame_incremental' view; this
complements commit 2b1e172 (gitweb: Fix handling of fractional
timezones in parse_date, 2011-03-25).

Now

  gitweb.cgi/git.git/blame_incremental/3fe5489:/contrib/gitview/gitview#l853

and

  gitweb.cgi/git.git/blame/3fe5489:/contrib/gitview/gitview#l853

show the same correct time in author's local timezone in title
(on mouseover) [Aneesh Kumar K.V, 2006-02-24 00:59:42 +0530].

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoStart preparing for 1.7.4.4
Junio C Hamano [Sun, 3 Apr 2011 19:58:23 +0000 (12:58 -0700)]
Start preparing for 1.7.4.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agopull: do not clobber untracked files on initial pull
Jeff King [Fri, 25 Mar 2011 18:13:31 +0000 (14:13 -0400)]
pull: do not clobber untracked files on initial pull

For a pull into an unborn branch, we do not use "git merge"
at all. Instead, we call read-tree directly. However, we
used the --reset parameter instead of "-m", which turns off
the safety features.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/index-update-if-able' into maint
Junio C Hamano [Sun, 3 Apr 2011 19:33:05 +0000 (12:33 -0700)]
Merge branch 'jc/index-update-if-able' into maint

* jc/index-update-if-able:
  update $GIT_INDEX_FILE when there are racily clean entries
  diff/status: refactor opportunistic index update

13 years agoMerge branch 'lt/default-abbrev' into maint
Junio C Hamano [Sun, 3 Apr 2011 19:32:51 +0000 (12:32 -0700)]
Merge branch 'lt/default-abbrev' into maint

* lt/default-abbrev:
  Rename core.abbrevlength back to core.abbrev
  Make the default abbrev length configurable

13 years agoMerge branch 'jc/maint-rev-list-culled-boundary' into maint
Junio C Hamano [Sun, 3 Apr 2011 19:32:35 +0000 (12:32 -0700)]
Merge branch 'jc/maint-rev-list-culled-boundary' into maint

* jc/maint-rev-list-culled-boundary:
  list-objects.c: don't add an unparsed NULL as a pending tree

Conflicts:
list-objects.c

13 years agoMerge branch 'mm/maint-log-n-with-diff-filtering' into maint
Junio C Hamano [Sun, 3 Apr 2011 19:31:59 +0000 (12:31 -0700)]
Merge branch 'mm/maint-log-n-with-diff-filtering' into maint

* mm/maint-log-n-with-diff-filtering:
  log: fix --max-count when used together with -S or -G

13 years agoMerge branch 'jk/format-patch-multiline-header' into maint
Junio C Hamano [Sun, 3 Apr 2011 19:31:19 +0000 (12:31 -0700)]
Merge branch 'jk/format-patch-multiline-header' into maint

* jk/format-patch-multiline-header:
  format-patch: rfc2047-encode newlines in headers
  format-patch: wrap long header lines
  strbuf: add fixed-length version of add_wrapped_text

13 years agoMerge branch 'jn/maint-instaweb-plack-fix' into maint
Junio C Hamano [Sun, 3 Apr 2011 19:30:58 +0000 (12:30 -0700)]
Merge branch 'jn/maint-instaweb-plack-fix' into maint

* jn/maint-instaweb-plack-fix:
  git-instaweb: Change how gitweb.psgi is made runnable as standalone app

13 years agoMerge branch 'lp/config-vername-check' into maint
Junio C Hamano [Sun, 3 Apr 2011 19:29:45 +0000 (12:29 -0700)]
Merge branch 'lp/config-vername-check' into maint

* lp/config-vername-check:
  Disallow empty section and variable names
  Sanity-check config variable names

13 years agocompat: add missing #include <sys/resource.h>
Jonathan Nieder [Fri, 18 Mar 2011 20:23:52 +0000 (15:23 -0500)]
compat: add missing #include <sys/resource.h>

Starting with commit c793430 (Limit file descriptors used by packs,
2011-02-28), git uses getrlimit to tell how many file descriptors it
can use.  Unfortunately it does not include the header declaring that
function, resulting in compilation errors:

 sha1_file.c: In function 'open_packed_git_1':
 sha1_file.c:718: error: storage size of 'lim' isn't known
 sha1_file.c:721: warning: implicit declaration of function 'getrlimit'
 sha1_file.c:721: error: 'RLIMIT_NOFILE' undeclared (first use in this function)
 sha1_file.c:718: warning: unused variable 'lim'

The standard header to include for this is <sys/resource.h> (which on
some systems itself requires declarations from <sys/types.h> or
<sys/time.h>).  Probably the problem was missed until now because in
current glibc sys/resource.h happens to be included by sys/wait.h.

MinGW does not provide sys/resource.h (and compat/mingw takes care of
providing getrlimit some other way), so add the missing #include to
the "#ifndef __MINGW32__" block in git-compat-util.h.

Reported-by: Stefan Sperling <stsp@stsp.name>
Tested-by: Stefan Sperling <stsp@stsp.name> [on OpenBSD]
Tested-by: Arnaud Lacombe <lacombar@gmail.com> [on FreeBSD 8]
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.4.3 v1.7.4.3
Junio C Hamano [Sun, 3 Apr 2011 07:12:31 +0000 (00:12 -0700)]
Git 1.7.4.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDoc: mention --delta-base-offset is the default for Porcelain commands
Junio C Hamano [Sun, 3 Apr 2011 06:08:13 +0000 (23:08 -0700)]
Doc: mention --delta-base-offset is the default for Porcelain commands

The underlying pack-objects plumbing command still needs an explicit
option from the command line, but these days Porcelain passes the
option, so there is no need for end users to worry about it anymore.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'nd/index-doc' into maint
Junio C Hamano [Fri, 1 Apr 2011 23:23:55 +0000 (16:23 -0700)]
Merge branch 'nd/index-doc' into maint

* nd/index-doc:
  doc: technical details about the index file format
  doc: technical details about the index file format

13 years agoMerge branch 'pk/stash-apply-status-relative' into maint
Junio C Hamano [Fri, 1 Apr 2011 23:23:43 +0000 (16:23 -0700)]
Merge branch 'pk/stash-apply-status-relative' into maint

* pk/stash-apply-status-relative:
  Add test: git stash shows status relative to current dir
  git stash: show status relative to current directory

13 years agoMerge branch 'jc/maint-diff-q-filter' into maint
Junio C Hamano [Fri, 1 Apr 2011 23:23:34 +0000 (16:23 -0700)]
Merge branch 'jc/maint-diff-q-filter' into maint

* jc/maint-diff-q-filter:
  diff --quiet: disable optimization when --diff-filter=X is used

13 years agoMerge branch 'js/maint-stash-index-copy' into maint
Junio C Hamano [Fri, 1 Apr 2011 23:23:21 +0000 (16:23 -0700)]
Merge branch 'js/maint-stash-index-copy' into maint

* js/maint-stash-index-copy:
  stash: copy the index using --index-output instead of cp -p
  stash: fix incorrect quoting in cleanup of temporary files

13 years agoMerge branch 'mg/doc-bisect-tweak-worktree' into maint
Junio C Hamano [Fri, 1 Apr 2011 23:23:15 +0000 (16:23 -0700)]
Merge branch 'mg/doc-bisect-tweak-worktree' into maint

* mg/doc-bisect-tweak-worktree:
  git-bisect.txt: example for bisecting with hot-fix
  git-bisect.txt: streamline run presentation

13 years agoMerge branch 'jh/maint-do-not-track-non-branches' into maint
Junio C Hamano [Fri, 1 Apr 2011 23:20:45 +0000 (16:20 -0700)]
Merge branch 'jh/maint-do-not-track-non-branches' into maint

* jh/maint-do-not-track-non-branches:
  branch/checkout --track: Ensure that upstream branch is indeed a branch

13 years agoMerge branch 'fk/maint-cvsimport-early-failure' into maint
Junio C Hamano [Fri, 1 Apr 2011 23:20:24 +0000 (16:20 -0700)]
Merge branch 'fk/maint-cvsimport-early-failure' into maint

* fk/maint-cvsimport-early-failure:
  git-cvsimport.perl: Bail out right away when reading from the server fails

13 years agoMerge branch 'jc/maint-apply-report-offset' into maint
Junio C Hamano [Fri, 1 Apr 2011 23:20:19 +0000 (16:20 -0700)]
Merge branch 'jc/maint-apply-report-offset' into maint

* jc/maint-apply-report-offset:
  apply -v: show offset count when patch did not apply exactly

13 years agoMerge branch 'jc/maint-apply-no-double-patch' into maint
Junio C Hamano [Fri, 1 Apr 2011 23:20:11 +0000 (16:20 -0700)]
Merge branch 'jc/maint-apply-no-double-patch' into maint

* jc/maint-apply-no-double-patch:
  apply: do not patch lines that were already patched

13 years agoMerge branch 'js/checkout-untracked-symlink' into maint
Junio C Hamano [Fri, 1 Apr 2011 23:19:03 +0000 (16:19 -0700)]
Merge branch 'js/checkout-untracked-symlink' into maint

* js/checkout-untracked-symlink:
  do not overwrite untracked symlinks
  Demonstrate breakage: checkout overwrites untracked symlink with directory

13 years agoMerge "checkout ambiguous ref bugfix" into maint
Junio C Hamano [Fri, 1 Apr 2011 23:16:23 +0000 (16:16 -0700)]
Merge "checkout ambiguous ref bugfix" into maint

* commit '0cb6ad3':
  checkout: fix bug with ambiguous refs

13 years ago"log --cherry-pick" documentation regression fix
Junio C Hamano [Fri, 1 Apr 2011 18:04:46 +0000 (11:04 -0700)]
"log --cherry-pick" documentation regression fix

Earlier f98fd43 (git-log.txt,rev-list-options.txt: put option blocks in
proper order, 2011-03-08) moved the text around in the documentation for
options in the rev-list family of commands such as "log".  Consequently,
the description of the --cherry-pick option appears way above the
description of the --left-right option now.

But the description of the --cherry-pick option still refers to the
example for the --left-right option, like this:

    ... with --left-right, like the example ABOVE in the description of
    that option.

Rephrase it to clarify that we are making a forward reference.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodocs: fix filter-branch subdir example for exotic repo names
Jeff King [Fri, 1 Apr 2011 14:46:27 +0000 (10:46 -0400)]
docs: fix filter-branch subdir example for exotic repo names

The GIT_INDEX_FILE variable we get from git has the full
path to the repo, which may contain spaces. When we use it
in our shell snippet, it needs to be quoted.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoparse-remote: typofix
Junio C Hamano [Thu, 31 Mar 2011 02:33:33 +0000 (19:33 -0700)]
parse-remote: typofix

An earlier patch had a trivial typo that two people did not notice.
Pointed out by Michael Schubert.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosubmodule: process conflicting submodules only once
Nicolas Morey-Chaisemartin [Wed, 30 Mar 2011 05:20:02 +0000 (07:20 +0200)]
submodule: process conflicting submodules only once

During a merge module_list returns conflicting submodules several times
(stage 1,2,3) which caused the submodules to be used multiple times in
git submodule init, sync, update and status command.

There are 5 callers of module_list; they all read (mode, sha1, stage,
path) tuple, and most of them care only about path.  As a first level
approximation, it should be Ok (in the sense that it does not make things
worse than it currently is) to filter the duplicate paths from module_list
output, but some callers should change their behaviour when the merge in
the superproject still has conflicts.

Notice the higher-stage entries, and emit only one record from
module_list, but while doing so, mark the entry with "U" (not [0-3]) in
the $stage field and null out the SHA-1 part, as the object name for the
lowest stage does not give any useful information to the caller, and this
way any caller that uses the object name would hopefully barf.  Then
update the codepaths for each subcommands this way:

 - "update" should not touch the submodule repository, because we do not
   know what commit should be checked out yet.

 - "status" reports the conflicting submodules as 'U000...000' and does
   not recurse into them (we might later want to make it recurse).

 - The command called by "foreach" may want to do whatever it wants to do
   by noticing the merged status in the superproject itself, so feed the
   path to it from module_list as before, but only once per submodule.

 - "init" and "sync" are unlikely things to do while the superproject is
   still not merged, but as long as a submodule is there in $path, there
   is no point skipping it. It might however want to take the merged
   status of .gitmodules into account, but that is outside of the scope of
   this topic.

Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Thanks-to: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocontrib/thunderbird-patch-inline: do not require bash to run the script
Maxin john [Wed, 30 Mar 2011 08:52:23 +0000 (09:52 +0100)]
contrib/thunderbird-patch-inline: do not require bash to run the script

The script does not have to be run under bash, but any POSIX compliant
shell would do, as it does not use any bash-isms.

It may be written under a different style than what is recommended in
Documentation/CodingGuidelines, but that is a different matter.

While at it, fix obvious typos in the comment.

Signed-off-by: Maxin B. John <maxin@maxinbjohn.info>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot8001: check the exit status of the command being tested
Junio C Hamano [Wed, 30 Mar 2011 19:22:05 +0000 (12:22 -0700)]
t8001: check the exit status of the command being tested

Avoid running the command being tested as an upstream of a pipe;
doing so will lose its exit status.

While at it, modernise the style of the script.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agostrbuf.h: remove a tad stale docs-in-comment and reference api-doc instead
Michael Witten [Tue, 15 Feb 2011 23:12:04 +0000 (23:12 +0000)]
strbuf.h: remove a tad stale docs-in-comment and reference api-doc instead

Signed-off-by: Michael Witten <mfwitten@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoTypos: t/README
Michael Witten [Tue, 22 Feb 2011 17:15:00 +0000 (17:15 +0000)]
Typos: t/README

Signed-off-by: Michael Witten <mfwitten@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation/config.txt: make truth value of numbers more explicit
Carlos Martín Nieto [Wed, 30 Mar 2011 10:22:32 +0000 (12:22 +0200)]
Documentation/config.txt: make truth value of numbers more explicit

Change the order to 1/0 to have the same true/false order as the rest
of the possibilities for a boolean variable in order not not confuse
users.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-pack-objects.txt: fix grammatical errors
Stephen Boyd [Wed, 30 Mar 2011 09:00:06 +0000 (02:00 -0700)]
git-pack-objects.txt: fix grammatical errors

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoparse-remote: replace unnecessary sed invocation
Stephen Boyd [Wed, 30 Mar 2011 08:48:40 +0000 (01:48 -0700)]
parse-remote: replace unnecessary sed invocation

Just use parameter expansion instead.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoHOME must be set before calling git-init when creating test repositories
Alex Riesen [Sat, 26 Mar 2011 18:46:34 +0000 (19:46 +0100)]
HOME must be set before calling git-init when creating test repositories

Otherwise the created test repositories will be affected by users ~/.gitconfig.
For example, setting core.logAllrefupdates in users config will make all
calls to "git config --unset core.logAllrefupdates" fail which will break
the first test which uses the statement and expects it to succeed.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit tag documentation grammar fixes and readability updates
Michael Witten [Mon, 28 Mar 2011 15:11:49 +0000 (15:11 +0000)]
git tag documentation grammar fixes and readability updates

... with help from Eric Raible.

In addition, describe the use of GIT_COMMITTER_DATE more comprehensively
by including "date-formats.txt"

Signed-off-by: Michael Witten <mfwitten@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogrep: Add the option '--line-number'
Joe Ratterman [Mon, 28 Mar 2011 18:11:55 +0000 (13:11 -0500)]
grep: Add the option '--line-number'

This is a synonym for the existing '-n' option, matching GNU grep.

Signed-off-by: Joe Ratterman <jratt0@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.4.2 v1.7.4.2
Junio C Hamano [Sat, 26 Mar 2011 00:56:14 +0000 (17:56 -0700)]
Git 1.7.4.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Fix handling of fractional timezones in parse_date
Jakub Narebski [Fri, 25 Mar 2011 19:20:49 +0000 (20:20 +0100)]
gitweb: Fix handling of fractional timezones in parse_date

Fractional timezones, like -0330 (NST used in Canada) or +0430
(Afghanistan, Iran DST), were not handled properly in parse_date; this
means values such as 'minute_local' and 'iso-tz' were not generated
correctly.

This was caused by two mistakes:

* sign of timezone was applied only to hour part of offset, and not
  as it should be also to minutes part (this affected only negative
  fractional timezones).

* 'int $h + $m/60' is 'int($h + $m/60)' and not 'int($h) + $m/60',
  so fractional part was discarded altogether ($h is hours, $m is
  minutes, which is always less than 60).

Note that positive fractional timezones +0430, +0530 and +1030 can be
found as authortime in git.git repository itself.

For example http://repo.or.cz/w/git.git/commit/88d50e7 had authortime
of "Fri, 8 Jan 2010 18:48:07 +0000 (23:48 +0530)", which is not marked
with 'atnight', when "git show 88d50e7" gives correct author date of
"Sat Jan 9 00:18:07 2010 +0530".

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodoc: technical details about the index file format
Junio C Hamano [Wed, 2 Mar 2011 01:51:01 +0000 (17:51 -0800)]
doc: technical details about the index file format

 * Clarify "string of unsigned bytes";

 * Blob has two variants (regular file vs symlink), not (blob vs symlink);

 * Clarify permission mode bits;

 * Clarify ce_namelen() "too long to fit in the length field" case;

 * Clarify "." etc are forbidden as path components;

 * Match the description with the internal wording "cache-tree";

 * All types of extension begin with signature and length as explained in
   the first part. Don't repeat the "length" part in the description of
   each extension (can be mistaken as if there is a separate 32-bit size
   field inside the extension), but state what the signature for each
   extension is.

 * Don't say "Extension tag", as we have said "Extension signature" in the
   first part---be consistent;

 * Clarify the invalidation of cache-tree entries;

 * Correct description on subtree_nr field in the cache-tree;

 * Clarify the order of entries in cache-tree;

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-am.txt: advertise 'git am --abort' instead of 'rm .git/rebase-apply'
SZEDER Gábor [Tue, 22 Mar 2011 18:42:25 +0000 (19:42 +0100)]
git-am.txt: advertise 'git am --abort' instead of 'rm .git/rebase-apply'

'git am --abort' is around for quite a long time now, and users should
normally not poke around inside the .git directory, yet the
documentation of 'git am' still recommends the following:

  ... if you decide to start over from scratch,
  run `rm -f -r .git/rebase-apply` ...

Suggest 'git am --abort' instead.

It's not quite the same as the original, because 'git am --abort' will
restore the original branch, while simply removing '.git/rebase-apply'
won't, but that's rather a thinko in the original wording, because
that won't actually "start over _from scratch_".

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoupdate $GIT_INDEX_FILE when there are racily clean entries
Junio C Hamano [Mon, 21 Mar 2011 17:18:19 +0000 (10:18 -0700)]
update $GIT_INDEX_FILE when there are racily clean entries

Traditional "opportunistic index update" done by read-only "diff" and
"status" was about updating cached lstat(2) information in the index for
the next round.  We missed another obvious optimization opportunity: when
there are racily clean entries that will cease to be racily clean by
updating $GIT_INDEX_FILE.  Detect that case and write $GIT_INDEX_FILE out
to give it a newer timestamp.

Noticed by Lasse Makholm by stracing "git status" in a fresh checkout and
counting the number of open(2) calls.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff/status: refactor opportunistic index update
Junio C Hamano [Mon, 21 Mar 2011 17:16:10 +0000 (10:16 -0700)]
diff/status: refactor opportunistic index update

When we had to refresh the index internally before running diff or status,
we opportunistically updated the $GIT_INDEX_FILE so that later invocation
of git can use the lstat(2) we already did in this invocation.

Make them share a helper function to do so.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobisect: visualize with git-log if gitk is unavailable
Jeff King [Mon, 21 Mar 2011 13:14:22 +0000 (09:14 -0400)]
bisect: visualize with git-log if gitk is unavailable

If gitk is not available in the PATH, bisect ends up
exiting with the shell's 127 error code, confusing the git
wrapper into thinking that bisect is not a git command.

We already fallback to git-log if there doesn't seem to be a
graphical display available. We should do the same if gitk
is not available in our PATH at all. This not only fixes the
ugly error message, but is a much more sensible default than
failing to show the user anything.

Reported by Maxin John.

Tested-by: Maxin B. John <maxin@maxinbjohn.info>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRename core.abbrevlength back to core.abbrev
Junio C Hamano [Mon, 21 Mar 2011 05:26:24 +0000 (22:26 -0700)]
Rename core.abbrevlength back to core.abbrev

It corresponds to --abbrev=$n command line option after all.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUpdate draft release notes to 1.7.4.2
Junio C Hamano [Mon, 21 Mar 2011 05:14:21 +0000 (22:14 -0700)]
Update draft release notes to 1.7.4.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'sp/maint-fd-limit' into maint
Junio C Hamano [Mon, 21 Mar 2011 05:11:46 +0000 (22:11 -0700)]
Merge branch 'sp/maint-fd-limit' into maint

* sp/maint-fd-limit:
  sha1_file.c: Don't retain open fds on small packs
  mingw: add minimum getrlimit() compatibility stub
  Limit file descriptors used by packs

13 years agoMerge branch 'mr/hpux' into maint
Junio C Hamano [Mon, 21 Mar 2011 05:11:15 +0000 (22:11 -0700)]
Merge branch 'mr/hpux' into maint

* mr/hpux:
  git-compat-util.h: Honor HP C's noreturn attribute
  Makefile: add NO_FNMATCH_CASEFOLD to HP-UX section

13 years agoMerge branch 'so/submodule-no-update-first-time' into maint
Junio C Hamano [Mon, 21 Mar 2011 05:11:02 +0000 (22:11 -0700)]
Merge branch 'so/submodule-no-update-first-time' into maint

* so/submodule-no-update-first-time:
  t7406: "git submodule update {--merge|--rebase]" with new submodules
  submodule: no [--merge|--rebase] when newly cloned

13 years agoMerge branch 'mo/perl-bidi-pipe-envfix' into maint
Junio C Hamano [Mon, 21 Mar 2011 05:10:31 +0000 (22:10 -0700)]
Merge branch 'mo/perl-bidi-pipe-envfix' into maint

* mo/perl-bidi-pipe-envfix:
  perl: command_bidi_pipe() method should set-up git environmens

13 years agoMerge branch 'ae/better-template-failure-report' into maint
Junio C Hamano [Mon, 21 Mar 2011 05:09:39 +0000 (22:09 -0700)]
Merge branch 'ae/better-template-failure-report' into maint

* ae/better-template-failure-report:
  Improve error messages when temporary file creation fails

13 years agoWork around broken ln on solaris as used in t8006
Ben Walton [Mon, 21 Mar 2011 01:12:26 +0000 (21:12 -0400)]
Work around broken ln on solaris as used in t8006

The test setup in t8006-blame-textconv.sh uses "ln -sf" to
overwrite an existing symlink.  Unfortunately, both /usr/bin/ln
and /usr/xpg4/bin/ln on solaris 9 don't properly handle -f and -s
used at the same time.  This caused the test setup and subsequent
checks to fail.

Instead, remove the symlink and then create a new one in the
setup code.

The upstream Solaris bug (fixed in 10, but not 9) is documented
here:

  http://bugs.opensolaris.org/view_bug.do?bug_id=4372462

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoAdd test: git stash shows status relative to current dir
Piotr Krukowiecki [Mon, 14 Mar 2011 19:19:36 +0000 (20:19 +0100)]
Add test: git stash shows status relative to current dir

[jc: moved "cd subdir" inside subshell and fixed comparison with expected]

Signed-off-by: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/README: Add a note about running commands under valgrind
Carlos Martín Nieto [Tue, 15 Mar 2011 09:32:11 +0000 (10:32 +0100)]
t/README: Add a note about running commands under valgrind

The test suite runs valgrind with certain options activated. Add a
note saying how to run commands under the same conditions as the test
suite does.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Always call parse_date with timezone parameter
Jakub Narebski [Sat, 19 Mar 2011 22:53:55 +0000 (23:53 +0100)]
gitweb: Always call parse_date with timezone parameter

Timezone is required to correctly set local time, which would be needed
for future 'localtime' feature.

While at it, remove unnecessary call to the function from git_log_body,
as its return value is not used anywhere.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobisect: explain the rationale behind 125
Junio C Hamano [Sun, 20 Mar 2011 04:46:06 +0000 (21:46 -0700)]
bisect: explain the rationale behind 125

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodocs: fix grammar in gitattributes.txt
Alexei Sholik [Fri, 18 Mar 2011 13:14:27 +0000 (15:14 +0200)]
docs: fix grammar in gitattributes.txt

[jc: with a fixlet from Marc Branchaud]

Signed-off-by: Alexei Sholik <alcosholik@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agostash: copy the index using --index-output instead of cp -p
Johannes Sixt [Wed, 16 Mar 2011 08:18:49 +0000 (09:18 +0100)]
stash: copy the index using --index-output instead of cp -p

'git stash create' must operate with a temporary index. For this purpose,
it used 'cp -p' to create a copy. -p is needed to preserve the timestamp
of the index file. Now Jakob Pfender reported a certain combination of
a Linux NFS client, OpenBSD NFS server, and cp implementation where this
operation failed.

Luckily, the first operation in git-stash after copying the index is to
call 'git read-tree'. Therefore, use --index-output instead of 'cp -p'
to write the copy of the index.

--index-output requires that the specified file is on the same volume as
the source index, so that the lock file can be rename()d. For this reason,
the name of the temporary index is constructed in a way different from the
other temporary files. The code path of 'stash -p' also needs a temporary
index, but we do not use the new name because it does not depend on the
same precondition as --index-output.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agostash: fix incorrect quoting in cleanup of temporary files
Johannes Sixt [Wed, 16 Mar 2011 08:14:33 +0000 (09:14 +0100)]
stash: fix incorrect quoting in cleanup of temporary files

The * was inside the quotes, so that the pattern was never expanded and the
temporary files were never removed. As a consequence, 'stash -p' left a
.git-stash-*-patch file in $GIT_DIR. Other code paths did not leave files
behind because they removed the temporary file themselves, at least in
non-error paths.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoPrepare draft release notes to 1.7.4.2
Junio C Hamano [Wed, 16 Mar 2011 23:29:03 +0000 (16:29 -0700)]
Prepare draft release notes to 1.7.4.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jn/maint-commit-missing-template' into maint
Junio C Hamano [Wed, 16 Mar 2011 23:47:26 +0000 (16:47 -0700)]
Merge branch 'jn/maint-commit-missing-template' into maint

* jn/maint-commit-missing-template:
  commit: error out for missing commit message template

13 years agoMerge branch 'lt/rename-no-extra-copy-detection' into maint
Junio C Hamano [Wed, 16 Mar 2011 23:47:26 +0000 (16:47 -0700)]
Merge branch 'lt/rename-no-extra-copy-detection' into maint

* lt/rename-no-extra-copy-detection:
  diffcore-rename: improve estimate_similarity() heuristics
  diffcore-rename: properly honor the difference between -M and -C
  for_each_hash: allow passing a 'void *data' pointer to callback

13 years agoMerge branch 'jk/diffstat-binary' into maint
Junio C Hamano [Wed, 16 Mar 2011 23:47:26 +0000 (16:47 -0700)]
Merge branch 'jk/diffstat-binary' into maint

* jk/diffstat-binary:
  diff: don't retrieve binary blobs for diffstat
  diff: handle diffstat of rewritten binary files

13 years agoMerge branch 'mg/maint-difftool-vim-readonly' into maint
Junio C Hamano [Wed, 16 Mar 2011 23:47:26 +0000 (16:47 -0700)]
Merge branch 'mg/maint-difftool-vim-readonly' into maint

* mg/maint-difftool-vim-readonly:
  mergetool-lib: call vim in readonly mode for diffs

13 years agoMerge branch 'jn/test-terminal-punt-on-osx-breakage' into maint
Junio C Hamano [Wed, 16 Mar 2011 23:47:26 +0000 (16:47 -0700)]
Merge branch 'jn/test-terminal-punt-on-osx-breakage' into maint

* jn/test-terminal-punt-on-osx-breakage:
  tests: skip terminal output tests on OS X

13 years agoMerge branch 'jk/fail-null-clone' into maint
Junio C Hamano [Wed, 16 Mar 2011 23:47:26 +0000 (16:47 -0700)]
Merge branch 'jk/fail-null-clone' into maint

* jk/fail-null-clone:
  clone: die when trying to clone missing local path

13 years agoMerge branch 'jh/push-default-upstream-configname' into maint
Junio C Hamano [Wed, 16 Mar 2011 23:47:26 +0000 (16:47 -0700)]
Merge branch 'jh/push-default-upstream-configname' into maint

* jh/push-default-upstream-configname:
  push.default: Rename 'tracking' to 'upstream'

13 years agoMerge branch 'mg/placeholders-are-lowercase' into maint
Junio C Hamano [Wed, 16 Mar 2011 23:47:25 +0000 (16:47 -0700)]
Merge branch 'mg/placeholders-are-lowercase' into maint

* mg/placeholders-are-lowercase:
  Make <identifier> lowercase in Documentation
  Make <identifier> lowercase as per CodingGuidelines
  Make <identifier> lowercase as per CodingGuidelines
  Make <identifier> lowercase as per CodingGuidelines
  CodingGuidelines: downcase placeholders in usage messages

13 years agoMerge branch 'mg/patch-id' into maint
Junio C Hamano [Wed, 16 Mar 2011 23:47:25 +0000 (16:47 -0700)]
Merge branch 'mg/patch-id' into maint

* mg/patch-id:
  git-patch-id: do not trip over "no newline" markers
  git-patch-id: test for "no newline" markers

13 years agoMerge branch 'js/maint-merge-use-prepare-commit-msg-hook' into maint
Junio C Hamano [Wed, 16 Mar 2011 23:47:25 +0000 (16:47 -0700)]
Merge branch 'js/maint-merge-use-prepare-commit-msg-hook' into maint

* js/maint-merge-use-prepare-commit-msg-hook:
  merge: honor prepare-commit-msg hook

13 years agogitweb: highlight: replace tabs with spaces
Kevin Cernekee [Wed, 16 Mar 2011 22:34:13 +0000 (15:34 -0700)]
gitweb: highlight: replace tabs with spaces

Consider the following code fragment:

        /*
         * test
         */

vim ":set list" mode shows that the first character on each line is a
tab:

^I/*$
^I * test$
^I */$

By default, the "highlight" program will retain the tabs in the HTML
output:

$ highlight --fragment --syntax c test.c
        <span class="hl com">/*</span>
<span class="hl com">    * test</span>
<span class="hl com">    */</span>

vim list mode:

^I<span class="hl com">/*</span>$
<span class="hl com">^I * test</span>$
<span class="hl com">^I */</span>$

In gitweb, this winds up looking something like:

   1         /*
   2     * test
   3     */

I tried both Firefox and Opera and saw the same behavior.

The desired output is:

   1         /*
   2          * test
   3          */

This can be accomplished by specifying "--replace-tabs=8" on the
highlight command line.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Acked-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff --quiet: disable optimization when --diff-filter=X is used
Junio C Hamano [Wed, 16 Mar 2011 22:46:08 +0000 (15:46 -0700)]
diff --quiet: disable optimization when --diff-filter=X is used

The code notices that the caller does not want any detail of the changes
and only wants to know if there is a change or not by specifying --quiet.
And it breaks out of the loop when it knows it already found any change.

When you have a post-process filter (e.g. --diff-filter), however, the
path we found to be different in the previous round and set HAS_CHANGES
bit may end up being uninteresting, and there may be no output at the end.
The optimization needs to be disabled for such case.

Note that the f245194 (diff: change semantics of "ignore whitespace"
options, 2009-05-22) already disables this optimization by refraining
from setting HAS_CHANGES when post-process filters that need to inspect
the contents of the files (e.g. -S, -w) in diff_change() function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomake_absolute_path: return the input path if it points to our buffer
Carlos Martín Nieto [Wed, 16 Mar 2011 16:06:17 +0000 (17:06 +0100)]
make_absolute_path: return the input path if it points to our buffer

Some codepaths call make_absolute_path with its own return value as
input. In such a cases, return the path immediately.

This fixes a valgrind-discovered error, whereby we tried to copy a
string onto itself.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agovalgrind: ignore SSE-based strlen invalid reads
Carlos Martín Nieto [Wed, 16 Mar 2011 11:46:01 +0000 (12:46 +0100)]
valgrind: ignore SSE-based strlen invalid reads

Some versions of strlen use SSE to speed up the calculation and load 4
bytes at a time, even if it means reading past the end of the
allocated memory. This read is safe and when the strlen function is
inlined, it is not replaced by valgrind, which reports a
false-possitive.

Tell valgrind to ignore this particular error, as the read is, in
fact, safe. Current upstream-released version 3.6.1 is affected. Some
distributions have this fixed in their latest versions.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff --submodule: split into bite-sized pieces
Jonathan Nieder [Wed, 16 Mar 2011 07:14:11 +0000 (02:14 -0500)]
diff --submodule: split into bite-sized pieces

Introduce two functions:

 - prepare_submodule_summary prepares the revision walker
   to list changes in a submodule.  That is, it:

   * finds merge bases between the commits pointed to this
     path from before ("left") and after ("right") the change;
   * checks whether this is a fast-forward or fast-backward;
   * prepares a revision walk to list commits in the symmetric
     difference between the commits at each endpoint.

   It returns nonzero on error.

 - print_submodule_summary runs the revision walk and saves
   the result to a strbuf in --left-right format.

The goal is just readability.  No functional change intended.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocherry: split off function to print output lines
Jonathan Nieder [Wed, 16 Mar 2011 07:12:48 +0000 (02:12 -0500)]
cherry: split off function to print output lines

Readers uninterested in the details of "git cherry"'s output format
can see

print_commit('-', commit, verbose, abbrev);

and ignore the details.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobranch: split off function that writes tracking info and commit subject
Jonathan Nieder [Wed, 16 Mar 2011 07:10:14 +0000 (02:10 -0500)]
branch: split off function that writes tracking info and commit subject

Introduce a add_verbose_info function that takes care of adding

 - an abbreviated object name;
 - a summary of the form [ahead x, behind y] of the relationship
   to the corresponding upstream branch;
 - a one line commit subject

for the tip commit of a branch, for use in "git branch -v" output.

No functional change intended.  This just unindents the code a little
and makes it easier to skip on first reading.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agostandardize brace placement in struct definitions
Jonathan Nieder [Wed, 16 Mar 2011 07:08:34 +0000 (02:08 -0500)]
standardize brace placement in struct definitions

In a struct definitions, unlike functions, the prevailing style is for
the opening brace to go on the same line as the struct name, like so:

 struct foo {
int bar;
char *baz;
 };

Indeed, grepping for 'struct [a-z_]* {$' yields about 5 times as many
matches as 'struct [a-z_]*$'.

Linus sayeth:

 Heretic people all over the world have claimed that this inconsistency
 is ...  well ...  inconsistent, but all right-thinking people know that
 (a) K&R are _right_ and (b) K&R are right.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>