Code

git.git
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: merge unborn index before setting ref
Jeff King [Fri, 25 Mar 2011 18:10:38 +0000 (14:10 -0400)]
merge: merge unborn index before setting ref

When we merge into an unborn branch, there are basically two
steps:

  1. Write the sha1 of the new commit into the ref pointed
     to by HEAD.

  2. Update the index with the new content, and check it out
     to the working tree.

We currently do them in this order. However, (2) is the step
that is much more likely to fail, since it can be blocked by
things like untracked working tree files. When it does, the
merge fails and we are left with an empty index but an
updated HEAD.

This patch switches the order, so that a failure in updating
the index leaves us unchanged. Of course, a failure in
updating the ref now leaves us with an updated index and
mis-matched HEAD. That is arguably not much better, but it
is probably less likely to actually happen.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot7607: clean up stray untracked file
Jeff King [Fri, 25 Mar 2011 18:09:03 +0000 (14:09 -0400)]
t7607: clean up stray untracked file

This file ends up conflicting with the test just after it
(causing the "git merge" to fail).  Neither test is to blame
for the bug, though. It looks like the merge in 1a9fe45
(Merge branch 'tr/merge-unborn-clobber', 2011-02-09) is what
caused the conflict.

We didn't notice because the follow-on test is already
marked as expect_failure (even though it has since been
fixed, and now succeeds once the untracked file is moved out
of the way).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot7607: mark known breakage in test 11 as fixed
Jeff King [Fri, 25 Mar 2011 18:08:36 +0000 (14:08 -0400)]
t7607: mark known breakage in test 11 as fixed

This was fixed by 1d718a51 (do not overwrite untracked
symlinks, 2011-02-20).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'kc/gitweb-pathinfo-w-anchor'
Junio C Hamano [Wed, 23 Mar 2011 21:55:55 +0000 (14:55 -0700)]
Merge branch 'kc/gitweb-pathinfo-w-anchor'

* kc/gitweb-pathinfo-w-anchor:
  gitweb: fix #patchNN anchors when path_info is enabled

13 years agoMerge branch 'jn/fortify-source-workaround'
Junio C Hamano [Wed, 23 Mar 2011 21:55:49 +0000 (14:55 -0700)]
Merge branch 'jn/fortify-source-workaround'

* jn/fortify-source-workaround:
  run-command: prettify -D_FORTIFY_SOURCE workaround

13 years agoMerge branch 'jn/maint-c99-format'
Junio C Hamano [Wed, 23 Mar 2011 21:55:46 +0000 (14:55 -0700)]
Merge branch 'jn/maint-c99-format'

* jn/maint-c99-format:
  unbreak and eliminate NO_C99_FORMAT
  mktag: avoid %td in format string

13 years agoMerge branch 'lt/default-abbrev'
Junio C Hamano [Wed, 23 Mar 2011 21:55:40 +0000 (14:55 -0700)]
Merge branch 'lt/default-abbrev'

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

13 years agoMerge branch 'pk/stash-apply-status-relative'
Junio C Hamano [Wed, 23 Mar 2011 21:55:37 +0000 (14:55 -0700)]
Merge branch 'pk/stash-apply-status-relative'

* 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'
Junio C Hamano [Wed, 23 Mar 2011 21:55:17 +0000 (14:55 -0700)]
Merge branch 'jc/maint-diff-q-filter'

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

13 years agoMerge branch 'pw/p4'
Junio C Hamano [Wed, 23 Mar 2011 21:54:24 +0000 (14:54 -0700)]
Merge branch 'pw/p4'

* pw/p4:
  git-p4: test sync new branch
  git-p4: fix sync new branch regression

13 years agoUpdate draft release notes to 1.7.5
Junio C Hamano [Wed, 23 Mar 2011 05:02:24 +0000 (22:02 -0700)]
Update draft release notes to 1.7.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'mg/rev-list-one-side-only'
Junio C Hamano [Wed, 23 Mar 2011 04:38:50 +0000 (21:38 -0700)]
Merge branch 'mg/rev-list-one-side-only'

* mg/rev-list-one-side-only:
  git-log: put space after commit mark
  t6007: test rev-list --cherry
  log --cherry: a synonym
  rev-list: documentation and test for --cherry-mark
  revision.c: introduce --cherry-mark
  rev-list/log: factor out revision mark generation
  rev-list: --left/right-only are mutually exclusive
  rev-list: documentation and test for --left/right-only
  t6007: Make sure we test --cherry-pick
  revlist.c: introduce --left/right-only for unsymmetric picking

13 years agoMerge branch 'js/maint-stash-index-copy'
Junio C Hamano [Wed, 23 Mar 2011 04:38:25 +0000 (21:38 -0700)]
Merge branch 'js/maint-stash-index-copy'

* 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 'tl/p4'
Junio C Hamano [Wed, 23 Mar 2011 04:38:19 +0000 (21:38 -0700)]
Merge branch 'tl/p4'

* tl/p4:
  git-p4: Fix error message crash in P4Sync.commit.
  Teach git-p4 to ignore case in perforce filenames if configured.
  git-p4: Teach gitConfig method about arguments.

13 years agoMerge branch 'mg/doc-bisect-tweak-worktree'
Junio C Hamano [Wed, 23 Mar 2011 04:38:15 +0000 (21:38 -0700)]
Merge branch 'mg/doc-bisect-tweak-worktree'

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

13 years agoMerge branch 'jn/test-sanitize-git-env'
Junio C Hamano [Wed, 23 Mar 2011 04:38:12 +0000 (21:38 -0700)]
Merge branch 'jn/test-sanitize-git-env'

* jn/test-sanitize-git-env:
  tests: scrub environment of GIT_* variables
  config: drop support for GIT_CONFIG_NOGLOBAL
  gitattributes: drop support for GIT_ATTR_NOGLOBAL
  tests: suppress system gitattributes
  tests: stop worrying about obsolete environment variables

13 years agoMerge branch 'sp/maint-upload-pack-stop-early'
Junio C Hamano [Wed, 23 Mar 2011 04:38:06 +0000 (21:38 -0700)]
Merge branch 'sp/maint-upload-pack-stop-early'

* sp/maint-upload-pack-stop-early:
  upload-pack: Implement no-done capability
  upload-pack: More aggressively send 'ACK %s ready'

13 years agoMerge branch 'sp/maint-fetch-pack-stop-early'
Junio C Hamano [Wed, 23 Mar 2011 04:38:03 +0000 (21:38 -0700)]
Merge branch 'sp/maint-fetch-pack-stop-early'

* sp/maint-fetch-pack-stop-early:
  fetch-pack: Implement no-done capability
  fetch-pack: Finish negotation if remote replies "ACK %s ready"

13 years agoMerge branch 'jc/maint-rev-list-culled-boundary'
Junio C Hamano [Wed, 23 Mar 2011 04:37:59 +0000 (21:37 -0700)]
Merge branch 'jc/maint-rev-list-culled-boundary'

* 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 'jc/maint-fetch-alt'
Junio C Hamano [Wed, 23 Mar 2011 04:37:53 +0000 (21:37 -0700)]
Merge branch 'jc/maint-fetch-alt'

* jc/maint-fetch-alt:
  fetch-pack: objects in our alternates are available to us
  refs_from_alternate: helper to use refs from alternates

Conflicts:
builtin/receive-pack.c

13 years agoMerge branch 'sg/complete-symmetric-diff'
Junio C Hamano [Wed, 23 Mar 2011 04:37:47 +0000 (21:37 -0700)]
Merge branch 'sg/complete-symmetric-diff'

* sg/complete-symmetric-diff:
  bash: complete 'git diff ...branc<TAB>'
  bash: fix misindented esac statement in __git_complete_file()

13 years agoMerge branch 'svn-fe' of git://repo.or.cz/git/jrn
Junio C Hamano [Wed, 23 Mar 2011 03:51:07 +0000 (20:51 -0700)]
Merge branch 'svn-fe' of git://repo.or.cz/git/jrn

* 'svn-fe' of git://repo.or.cz/git/jrn:
  vcs-svn: use strchr to find RFC822 delimiter
  vcs-svn: implement perfect hash for top-level keys
  vcs-svn: implement perfect hash for node-prop keys
  vcs-svn: use strbuf for author, UUID, and URL
  vcs-svn: use strbuf for revision log
  vcs-svn: improve reporting of input errors
  vcs-svn: make buffer_copy_bytes return length read
  vcs-svn: make buffer_skip_bytes return length read
  vcs-svn: improve support for reading large files
  vcs-svn: allow input errors to be detected promptly
  vcs-svn: simplify repo_modify_path and repo_copy
  vcs-svn: handle_node: use repo_read_path
  vcs-svn: introduce repo_read_path to check the content at a path

13 years agoMerge branch 'db/length-as-hash' into svn-fe
Jonathan Nieder [Tue, 22 Mar 2011 23:44:49 +0000 (18:44 -0500)]
Merge branch 'db/length-as-hash' into svn-fe

* db/length-as-hash:
  vcs-svn: use strchr to find RFC822 delimiter
  vcs-svn: implement perfect hash for top-level keys
  vcs-svn: implement perfect hash for node-prop keys

Conflicts:
vcs-svn/svndump.c

13 years agovcs-svn: use strchr to find RFC822 delimiter
David Barr [Tue, 14 Dec 2010 00:06:43 +0000 (11:06 +1100)]
vcs-svn: use strchr to find RFC822 delimiter

This is a small optimisation (4% reduction in user time) but is the
largest artifact within the parsing portion of svndump.c

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
13 years agovcs-svn: implement perfect hash for top-level keys
David Barr [Mon, 13 Dec 2010 08:56:01 +0000 (19:56 +1100)]
vcs-svn: implement perfect hash for top-level keys

Instead of interning property names and comparing their string_pool
keys, look them up in a table by string length, which should be about
as fast.

Another small step towards removing dependence on string_pool
altogether.

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
13 years agovcs-svn: implement perfect hash for node-prop keys
David Barr [Mon, 13 Dec 2010 08:13:24 +0000 (19:13 +1100)]
vcs-svn: implement perfect hash for node-prop keys

Instead of interning property names and comparing their string_pool
keys, look them up in a table by string length, which should be about
as fast.

This is a small step towards removing dependence on string_pool.

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
13 years agovcs-svn: use strbuf for author, UUID, and URL
David Barr [Tue, 22 Mar 2011 22:52:17 +0000 (17:52 -0500)]
vcs-svn: use strbuf for author, UUID, and URL

Use strbufs and strings instead of interned strings for values of rev,
dump, and node fields that happen to be strings.  After this change,
the only remaining string_pool use is for paths in the repo_tree API
and internals.

Functional change: treat an empty author, UUID, or URL as none at all.
So for example, in repos where the first revision has an empty
svn:author property, the first rev will be treated as by "nobody"
rather than by a person with empty name and email address created by
prepending an @ sign to the repository UUID.

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Tue, 22 Mar 2011 21:56:13 +0000 (14:56 -0700)]
Merge branch 'maint'

* maint:
  git-am.txt: advertise 'git am --abort' instead of 'rm .git/rebase-apply'
  bisect: visualize with git-log if gitk is unavailable

13 years agovcs-svn: use strbuf for revision log
David Barr [Mon, 21 Mar 2011 23:49:50 +0000 (10:49 +1100)]
vcs-svn: use strbuf for revision log

obj_pool is overkill for this application: all that is needed is a
buffer that can resize from rev to rev to accomodate differently-sized
strings.  In the spirit of commit deadcef4 (2010-11-06), use a strbuf
instead.

This is a small step towards removing dependence on obj_pool.h.

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
13 years agovcs-svn: improve reporting of input errors
Jonathan Nieder [Tue, 28 Dec 2010 10:30:54 +0000 (04:30 -0600)]
vcs-svn: improve reporting of input errors

Catch input errors and exit early enough to print a reasonable
diagnosis based on errno.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
13 years agovcs-svn: make buffer_copy_bytes return length read
Jonathan Nieder [Tue, 28 Dec 2010 10:26:17 +0000 (04:26 -0600)]
vcs-svn: make buffer_copy_bytes return length read

Currently buffer_copy_bytes does not report to its caller whether
it encountered an early end of file.

Add a return value representing the number of bytes read (but not
the number of bytes copied).  This way all three unusual conditions
can be distinguished: input error with buffer_ferror, output error
with ferror(outfile), early end of input by checking the return
value.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
13 years agovcs-svn: make buffer_skip_bytes return length read
Jonathan Nieder [Mon, 11 Oct 2010 02:44:21 +0000 (21:44 -0500)]
vcs-svn: make buffer_skip_bytes return length read

Currently there is no way to detect when input ended if it ended
early during buffer_skip_bytes.  Tell the calling program how many
bytes were actually skipped for easier debugging.

Existing callers will still ignore early EOF.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
13 years agovcs-svn: improve support for reading large files
Jonathan Nieder [Mon, 11 Oct 2010 02:46:24 +0000 (21:46 -0500)]
vcs-svn: improve support for reading large files

Move from uint32_t to off_t as the fundamental unit of length used by
the line_buffer library.  Performance would get worse if anything but
I think it's worth it for support of deltas that need to skip large
pieces (> 4 GiB).

Exception: buffer_read_string still takes a uint32_t, since it keeps
its result in an in-core obj_pool.

Callers still have to be updated to take advantage of this.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.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 agoFix sparse warnings
Stephen Boyd [Tue, 22 Mar 2011 07:51:05 +0000 (00:51 -0700)]
Fix sparse warnings

Fix warnings from 'make check'.

 - These files don't include 'builtin.h' causing sparse to complain that
   cmd_* isn't declared:

   builtin/clone.c:364, builtin/fetch-pack.c:797,
   builtin/fmt-merge-msg.c:34, builtin/hash-object.c:78,
   builtin/merge-index.c:69, builtin/merge-recursive.c:22
   builtin/merge-tree.c:341, builtin/mktag.c:156, builtin/notes.c:426
   builtin/notes.c:822, builtin/pack-redundant.c:596,
   builtin/pack-refs.c:10, builtin/patch-id.c:60, builtin/patch-id.c:149,
   builtin/remote.c:1512, builtin/remote-ext.c:240,
   builtin/remote-fd.c:53, builtin/reset.c:236, builtin/send-pack.c:384,
   builtin/unpack-file.c:25, builtin/var.c:75

 - These files have symbols which should be marked static since they're
   only file scope:

   submodule.c:12, diff.c:631, replace_object.c:92, submodule.c:13,
   submodule.c:14, trace.c:78, transport.c:195, transport-helper.c:79,
   unpack-trees.c:19, url.c:3, url.c:18, url.c:104, url.c:117, url.c:123,
   url.c:129, url.c:136, thread-utils.c:21, thread-utils.c:48

 - These files redeclare symbols to be different types:

   builtin/index-pack.c:210, parse-options.c:564, parse-options.c:571,
   usage.c:49, usage.c:58, usage.c:63, usage.c:72

 - These files use a literal integer 0 when they really should use a NULL
   pointer:

   daemon.c:663, fast-import.c:2942, imap-send.c:1072, notes-merge.c:362

While we're in the area, clean up some unused #includes in builtin files
(mostly exec_cmd.h).

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
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 drart release notes to 1.7.5
Junio C Hamano [Mon, 21 Mar 2011 05:24:24 +0000 (22:24 -0700)]
Update drart release notes to 1.7.5

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

* maint:
  Update draft release notes to 1.7.4.2
  Work around broken ln on solaris as used in t8006
  t/README: Add a note about running commands under valgrind

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 agoMerge branch 'mm/maint-log-n-with-diff-filtering'
Junio C Hamano [Sun, 20 Mar 2011 06:25:38 +0000 (23:25 -0700)]
Merge branch 'mm/maint-log-n-with-diff-filtering'

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

13 years agoMerge branch 'mg/rev-list-n-reverse-doc'
Junio C Hamano [Sun, 20 Mar 2011 06:25:32 +0000 (23:25 -0700)]
Merge branch 'mg/rev-list-n-reverse-doc'

* 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 agoMerge branch 'js/rerere-forget-always-take-pathspec'
Junio C Hamano [Sun, 20 Mar 2011 06:24:48 +0000 (23:24 -0700)]
Merge branch 'js/rerere-forget-always-take-pathspec'

* js/rerere-forget-always-take-pathspec:
  rerere forget: deprecate invocation without pathspec

13 years agoMerge branch 'ab/i18n-basic'
Junio C Hamano [Sun, 20 Mar 2011 06:24:42 +0000 (23:24 -0700)]
Merge branch 'ab/i18n-basic'

* ab/i18n-basic:
  i18n: "make distclean" should clean up after "make pot"
  i18n: Makefile: "pot" target to extract messages marked for translation
  i18n: add stub Q_() wrapper for ngettext
  i18n: do not poison translations unless GIT_GETTEXT_POISON envvar is set
  i18n: add GETTEXT_POISON to simulate unfriendly translator
  i18n: add no-op _() and N_() wrappers
  commit, status: use status_printf{,_ln,_more} helpers
  commit: refer to commit template as s->fp
  wt-status: add helpers for printing wt-status lines

Conflicts:
builtin/commit.c

13 years agoMerge branch 'uk/ls-remote-in-get-remote-url'
Junio C Hamano [Sun, 20 Mar 2011 06:24:34 +0000 (23:24 -0700)]
Merge branch 'uk/ls-remote-in-get-remote-url'

* uk/ls-remote-in-get-remote-url:
  git-request-pull: open-code the only invocation of get_remote_url
  get_remote_url(): use the same data source as ls-remote to get remote urls

13 years agoMerge branch 'ss/mergetool--lib'
Junio C Hamano [Sun, 20 Mar 2011 06:24:27 +0000 (23:24 -0700)]
Merge branch 'ss/mergetool--lib'

* ss/mergetool--lib:
  mergetool--lib: Add Beyond Compare 3 as a tool
  mergetool--lib: Sort tools alphabetically for easier lookup

13 years agoMerge branch 'jn/status-translatable'
Junio C Hamano [Sun, 20 Mar 2011 06:24:19 +0000 (23:24 -0700)]
Merge branch 'jn/status-translatable'

* jn/status-translatable:
  commit, status: use status_printf{,_ln,_more} helpers
  commit: refer to commit template as s->fp
  wt-status: add helpers for printing wt-status lines

Conflicts:
builtin/commit.c

13 years agoMerge branch 'jk/trace-sifter'
Junio C Hamano [Sun, 20 Mar 2011 06:24:12 +0000 (23:24 -0700)]
Merge branch 'jk/trace-sifter'

* jk/trace-sifter:
  trace: give repo_setup trace its own key
  add packet tracing debug code
  trace: add trace_strbuf
  trace: factor out "do we want to trace" logic
  trace: refactor to support multiple env variables
  trace: add trace_vprintf

13 years agoMerge branch 'jk/format-patch-multiline-header'
Junio C Hamano [Sun, 20 Mar 2011 06:24:08 +0000 (23:24 -0700)]
Merge branch 'jk/format-patch-multiline-header'

* 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 'jk/merge-rename-ux'
Junio C Hamano [Sun, 20 Mar 2011 06:23:56 +0000 (23:23 -0700)]
Merge branch 'jk/merge-rename-ux'

* jk/merge-rename-ux:
  pull: propagate --progress to merge
  merge: enable progress reporting for rename detection
  add inexact rename detection progress infrastructure
  commit: stop setting rename limit
  bump rename limit defaults (again)
  merge: improve inexact rename limit warning

13 years agoMerge branch 'maint'
Junio C Hamano [Sun, 20 Mar 2011 06:21:10 +0000 (23:21 -0700)]
Merge branch 'maint'

* maint:
  gitweb: Always call parse_date with timezone parameter
  bisect: explain the rationale behind 125

13 years agogrep: read patterns from stdin with -f -
René Scharfe [Sat, 19 Mar 2011 18:33:15 +0000 (19:33 +0100)]
grep: read patterns from stdin with -f -

Support the well-know convention of reading standard input instead of a
named file if "-" (dash) is specified.  GNU grep does the same.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
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 agoMerge branch 'maint'
Junio C Hamano [Fri, 18 Mar 2011 23:20:49 +0000 (16:20 -0700)]
Merge branch 'maint'

* maint:
  docs: fix grammar in gitattributes.txt

13 years agogitweb: fix #patchNN anchors when path_info is enabled
Kevin Cernekee [Fri, 18 Mar 2011 16:00:16 +0000 (17:00 +0100)]
gitweb: fix #patchNN anchors when path_info is enabled

When $feature{'pathinfo'} is used, gitweb script sets the base URL to
itself, so that relative links to static files work correctly.  It
does it by adding something like below to HTML head:

  <base href="http://HOST/gitweb.cgi">

This breaks the "patch" anchor links seen on the commitdiff pages,
because these links, being relative (<a href="#patch1">), are resolved
(computed) relative to the base URL and not relative to current URL,
i.e. as:

  http://HOST/gitweb.cgi#patch1

Instead, they should look like this:

  http://HOST/gitweb.cgi/myproject.git/commitdiff/35a9811ef9d68eae9afd76bede121da4f89b448c#patch1

Add an "-anchor" parameter to href(), and use href(-anchor=>"patch1")
to generate "patch" anchor links, so that the full path is included in
the patch link.

While at it, convert

  print "foo";
  print "bar";

to

  print "foo" .
        "bar";

in the neighborhood of changes.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
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 agofetch-pack: objects in our alternates are available to us
Junio C Hamano [Fri, 11 Mar 2011 19:53:52 +0000 (11:53 -0800)]
fetch-pack: objects in our alternates are available to us

Use the helper function split from the receiving end of "git push" to
allow the same optimization on the receiving end of "git fetch".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
13 years agorefs_from_alternate: helper to use refs from alternates
Junio C Hamano [Fri, 11 Mar 2011 19:32:53 +0000 (11:32 -0800)]
refs_from_alternate: helper to use refs from alternates

The receiving end of "git push" advertises the objects that the repository
itself does not use, but are at the tips of refs in other repositories
whose object databases are used as alternates for it. This helps it avoid
having to receive (and the pusher having to send) objects that are already
available to the receiving repository via the alternates mechanism.

Tweak the helper function that implements this feature, and move it to
transport.[ch] for future reuse by other programs.

The additional test demonstrates how this optimization is helping "git push",
and "git fetch" is ignorant about it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoName make_*_path functions more accurately
Carlos Martín Nieto [Thu, 17 Mar 2011 11:26:46 +0000 (12:26 +0100)]
Name make_*_path functions more accurately

Rename the make_*_path functions so it's clearer what they do, in
particlar make clear what the differnce between make_absolute_path and
make_nonrelative_path is by renaming them real_path and absolute_path
respectively. make_relative_path has an understandable name and is
renamed to relative_path to maintain the name convention.

The function calls have been replaced 1-to-1 in their usage.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorun-command: prettify -D_FORTIFY_SOURCE workaround
Jonathan Nieder [Wed, 16 Mar 2011 07:32:39 +0000 (02:32 -0500)]
run-command: prettify -D_FORTIFY_SOURCE workaround

Current gcc + glibc with -D_FORTIFY_SOURCE try very aggressively to
protect against a programming style which uses write(...) without
checking the return value for errors.  Even the usual hint of casting
to (void) does not suppress the warning.

Sometimes when there is an output error, especially right before exit,
there really is nothing to be done.  The obvious solution, adopted in
v1.7.0.3~20^2 (run-command.c: fix build warnings on Ubuntu,
2010-01-30), is to save the return value to a dummy variable:

ssize_t dummy;
dummy = write(...);

But that (1) is ugly and (2) triggers -Wunused-but-set-variable
warnings with gcc-4.6 -Wall, so we are not much better off than when
we started.

Instead, use an "if" statement with an empty body to make the intent
clear.

if (write(...))
; /* yes, yes, there was an error. */

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agounbreak and eliminate NO_C99_FORMAT
Jonathan Nieder [Wed, 16 Mar 2011 05:15:31 +0000 (00:15 -0500)]
unbreak and eliminate NO_C99_FORMAT

In the spirit of v1.5.0.2~21 (Check for PRIuMAX rather than
NO_C99_FORMAT in fast-import.c, 2007-02-20), use PRIuMAX from
git-compat-util.h on all platforms instead of C99-specific formats
like %zu with dangerous fallbacks to %u or %lu.

So now C99-challenged platforms can build git without provoking
warnings or errors from printf, even if pointers do not have the same
size as an int or long.

The need for a fallback PRIuMAX is detected in git-compat-util.h with
"#ifndef PRIuMAX".  So while at it, simplify the Makefile and configure
script by eliminating the NO_C99_FORMAT knob altogether.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomktag: avoid %td in format string
Jonathan Nieder [Wed, 16 Mar 2011 05:14:22 +0000 (00:14 -0500)]
mktag: avoid %td in format string

Since v1.7.0-rc0~34 (make "mktag" a built-in, 2010-01-22), git mktag
uses the C99-style %td format to print ptrdiff_t values.  It falls
back to %d when NO_C99_FORMAT is set, on the assumption that pre-C99
systems probably are using 32-bit pointers.

But many modern systems are 64-bit and

 * sometimes one wants to test the NO_C99_FORMAT fallbacks using a
   modern development platform;
 * some platforms (I'm looking at you, msvc) have not gotten with the
   program and are still C89-only.

These ptrdiff_t values are offsets from the beginning of a buffer, so
a size_t or uintmax_t would work about as well.  Use the latter so we
can take advantage of the PRIuMAX fallback in git-compat-util.h, even
on C99-challenged systems with 64-bit pointers.

Signed-off-by: Jonathan Nieder <jrnieder@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 agoRelNotes/1.7.5.txt: typo and language fixes
Michael J Gruber [Wed, 16 Mar 2011 09:23:23 +0000 (10:23 +0100)]
RelNotes/1.7.5.txt: typo and language fixes

Also remove entries for fixes that are already present in the
maintenance track.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Wed, 16 Mar 2011 23:59:30 +0000 (16:59 -0700)]
Merge branch 'maint'

* maint:
  Prepare draft release notes to 1.7.4.2
  gitweb: highlight: replace tabs with spaces
  make_absolute_path: return the input path if it points to our buffer
  valgrind: ignore SSE-based strlen invalid reads
  diff --submodule: split into bite-sized pieces
  cherry: split off function to print output lines
  branch: split off function that writes tracking info and commit subject
  standardize brace placement in struct definitions
  compat: make gcc bswap an inline function
  enums: omit trailing comma for portability

Conflicts:
RelNotes

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 agogit-p4: test sync new branch
Pete Wyckoff [Wed, 16 Mar 2011 20:53:53 +0000 (16:53 -0400)]
git-p4: test sync new branch

Add two new unit tests.  One to test the feature that that
was added in e32e00d, and another to test the regression
that was fixed in the parent to this commit.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-p4: fix sync new branch regression
Pete Wyckoff [Wed, 16 Mar 2011 20:52:46 +0000 (16:52 -0400)]
git-p4: fix sync new branch regression

e32e00d (git-p4: better message for "git-p4 sync" when not
cloned, 2011-02-19) broke another use case, that of using
"git-p4 sync" to import a new branch into an existing repository.

Refine the fix again, on top of the fix in ac34efc.

Reported-by: Michael Horowitz <michael.horowitz@ieee.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Tested-by: Michael Horowitz <michael.horowitz@ieee.org>
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 agovcs-svn: remove spurious semicolons
Jonathan Nieder [Wed, 16 Mar 2011 07:02:42 +0000 (02:02 -0500)]
vcs-svn: remove spurious semicolons

trp_gen is not a statement or function call, so it should not be
followed with a semicolon.  Noticed by gcc -pedantic.

 vcs-svn/repo_tree.c:41:81: warning: ISO C does not allow extra ';'
  outside of a function [-pedantic]

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
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>
13 years agocompat: make gcc bswap an inline function
Jonathan Nieder [Wed, 16 Mar 2011 07:00:49 +0000 (02:00 -0500)]
compat: make gcc bswap an inline function

Without this change, gcc -pedantic warns:

 cache.h: In function 'ce_to_dtype':
 cache.h:270:21: warning: ISO C forbids braced-groups within expressions [-pedantic]

An inline function is more readable anyway.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoenums: omit trailing comma for portability
Jonathan Nieder [Wed, 16 Mar 2011 06:59:10 +0000 (01:59 -0500)]
enums: omit trailing comma for portability

Since v1.7.2-rc0~23^2~2 (Add per-repository eol normalization,
2010-05-19), building with gcc -std=gnu89 -pedantic produces warnings
like the following:

 convert.c:21:11: warning: comma at end of enumerator list [-pedantic]

gcc is right to complain --- these commas are not permitted in C89.
In the spirit of v1.7.2-rc0~32^2~16 (2010-05-14), remove them.

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