git
13 years agoMerge jn/maint-http-error-message
Junio C Hamano [Tue, 1 Nov 2011 22:42:25 +0000 (15:42 -0700)] 
Merge jn/maint-http-error-message

* commit 'be22d92eac809ad2bfa2b7c83ad7cad5a15f1c43':
  http: avoid empty error messages for some curl errors
  http: remove extra newline in error message

13 years agoMerge branch 'rs/maint-estimate-cache-size' into maint
Junio C Hamano [Thu, 27 Oct 2011 19:03:16 +0000 (12:03 -0700)] 
Merge branch 'rs/maint-estimate-cache-size' into maint

* rs/maint-estimate-cache-size:
  read-cache.c: fix index memory allocation

13 years agoclone: Quote user supplied path in a single quote pair
Richard Hartmann [Thu, 27 Oct 2011 16:46:53 +0000 (18:46 +0200)] 
clone: Quote user supplied path in a single quote pair

Without this patch,

    $ git clone foo .

results in this:

    Cloning into ....
    done.

With it:

    Cloning into '.'...
    done.

Signed-off-by: Richard Hartmann <richih.mailinglist@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jn/gitweb-highlite-sanitise' into maint
Junio C Hamano [Wed, 26 Oct 2011 23:13:31 +0000 (16:13 -0700)] 
Merge branch 'jn/gitweb-highlite-sanitise' into maint

* jn/gitweb-highlite-sanitise:
  gitweb: Strip non-printable characters from syntax highlighter output

13 years agoMerge branch 'jk/argv-array' into maint
Junio C Hamano [Wed, 26 Oct 2011 23:13:31 +0000 (16:13 -0700)] 
Merge branch 'jk/argv-array' into maint

* jk/argv-array:
  run_hook: use argv_array API
  checkout: use argv_array API
  bisect: use argv_array API
  quote: provide sq_dequote_to_argv_array
  refactor argv_array into generic code
  quote.h: fix bogus comment
  add sha1_array API docs

13 years agoMerge branch 'jc/run-receive-hook-cleanup' into maint
Junio C Hamano [Wed, 26 Oct 2011 23:13:31 +0000 (16:13 -0700)] 
Merge branch 'jc/run-receive-hook-cleanup' into maint

* jc/run-receive-hook-cleanup:
  refactor run_receive_hook()

13 years agoMerge branch 'cn/eradicate-working-copy' into maint
Junio C Hamano [Wed, 26 Oct 2011 23:13:31 +0000 (16:13 -0700)] 
Merge branch 'cn/eradicate-working-copy' into maint

* cn/eradicate-working-copy:
  Remove 'working copy' from the documentation and C code

13 years agoMerge branch 'maint-1.7.6' into maint
Junio C Hamano [Wed, 26 Oct 2011 23:13:27 +0000 (16:13 -0700)] 
Merge branch 'maint-1.7.6' into maint

* maint-1.7.6:
  notes_merge_commit(): do not pass temporary buffer to other function
  gitweb: Fix links to lines in blobs when javascript-actions are enabled
  mergetool: no longer need to save standard input
  mergetool: Use args as pathspec to unmerged files
  t9159-*.sh: skip for mergeinfo test for svn <= 1.4
  date.c: Support iso8601 timezone formats
  remote: only update remote-tracking branch if updating refspec
  remote rename: warn when refspec was not updated
  remote: "rename o foo" should not rename ref "origin/bar"
  remote: write correct fetch spec when renaming remote 'remote'

13 years agoMerge branch 'mh/maint-notes-merge-pathbuf-fix' into maint-1.7.6
Junio C Hamano [Wed, 26 Oct 2011 23:12:48 +0000 (16:12 -0700)] 
Merge branch 'mh/maint-notes-merge-pathbuf-fix' into maint-1.7.6

* mh/maint-notes-merge-pathbuf-fix:
  notes_merge_commit(): do not pass temporary buffer to other function

13 years agoMerge branch 'ps/gitweb-js-with-lineno' into maint-1.7.6
Junio C Hamano [Wed, 26 Oct 2011 23:12:35 +0000 (16:12 -0700)] 
Merge branch 'ps/gitweb-js-with-lineno' into maint-1.7.6

* ps/gitweb-js-with-lineno:
  gitweb: Fix links to lines in blobs when javascript-actions are enabled

13 years agoMerge branch 'jm/mergetool-pathspec' into maint-1.7.6
Junio C Hamano [Wed, 26 Oct 2011 23:12:25 +0000 (16:12 -0700)] 
Merge branch 'jm/mergetool-pathspec' into maint-1.7.6

* jm/mergetool-pathspec:
  mergetool: no longer need to save standard input
  mergetool: Use args as pathspec to unmerged files

13 years agoMerge branch 'mz/remote-rename' into maint-1.7.6
Junio C Hamano [Wed, 26 Oct 2011 23:12:19 +0000 (16:12 -0700)] 
Merge branch 'mz/remote-rename' into maint-1.7.6

* mz/remote-rename:
  remote: only update remote-tracking branch if updating refspec
  remote rename: warn when refspec was not updated
  remote: "rename o foo" should not rename ref "origin/bar"
  remote: write correct fetch spec when renaming remote 'remote'

13 years agoMerge branch 'rj/maint-t9159-svn-rev-notation' into maint-1.7.6
Junio C Hamano [Wed, 26 Oct 2011 23:12:13 +0000 (16:12 -0700)] 
Merge branch 'rj/maint-t9159-svn-rev-notation' into maint-1.7.6

* rj/maint-t9159-svn-rev-notation:
  t9159-*.sh: skip for mergeinfo test for svn <= 1.4

13 years agoMerge branch 'hl/iso8601-more-zone-formats' into maint-1.7.6
Junio C Hamano [Wed, 26 Oct 2011 23:11:28 +0000 (16:11 -0700)] 
Merge branch 'hl/iso8601-more-zone-formats' into maint-1.7.6

* hl/iso8601-more-zone-formats:
  date.c: Support iso8601 timezone formats

13 years agoMerge branch 'maint-1.7.6' into maint
Junio C Hamano [Wed, 26 Oct 2011 23:09:28 +0000 (16:09 -0700)] 
Merge branch 'maint-1.7.6' into maint

* maint-1.7.6:
  make the sample pre-commit hook script reject names with newlines, too
  git-read-tree.txt: update sparse checkout examples
  git-read-tree.txt: correct sparse-checkout and skip-worktree description
  git-read-tree.txt: language and typography fixes
  unpack-trees: print "Aborting" to stderr
  Documentation/git-update-index: refer to 'ls-files'
  Documentation: basic configuration of notes.rewriteRef

13 years agoMerge branch 'tr/doc-note-rewrite' into maint-1.7.6
Junio C Hamano [Wed, 26 Oct 2011 23:09:04 +0000 (16:09 -0700)] 
Merge branch 'tr/doc-note-rewrite' into maint-1.7.6

* tr/doc-note-rewrite:
  Documentation: basic configuration of notes.rewriteRef

13 years agoMerge branch 'nd/sparse-doc' into maint-1.7.6
Junio C Hamano [Wed, 26 Oct 2011 23:09:04 +0000 (16:09 -0700)] 
Merge branch 'nd/sparse-doc' into maint-1.7.6

* nd/sparse-doc:
  git-read-tree.txt: update sparse checkout examples

13 years agoMerge branch 'mg/maint-doc-sparse-checkout' into maint-1.7.6
Junio C Hamano [Wed, 26 Oct 2011 23:09:03 +0000 (16:09 -0700)] 
Merge branch 'mg/maint-doc-sparse-checkout' into maint-1.7.6

* mg/maint-doc-sparse-checkout:
  git-read-tree.txt: correct sparse-checkout and skip-worktree description
  git-read-tree.txt: language and typography fixes
  unpack-trees: print "Aborting" to stderr

13 years agoMerge branch 'maint-1.7.5' into maint-1.7.6
Junio C Hamano [Wed, 26 Oct 2011 23:08:19 +0000 (16:08 -0700)] 
Merge branch 'maint-1.7.5' into maint-1.7.6

* maint-1.7.5:
  make the sample pre-commit hook script reject names with newlines, too
  Reindent closing bracket using tab instead of spaces
  Documentation/git-update-index: refer to 'ls-files'

13 years agoMerge branch 'maint-1.7.4' into maint-1.7.5
Junio C Hamano [Wed, 26 Oct 2011 23:08:14 +0000 (16:08 -0700)] 
Merge branch 'maint-1.7.4' into maint-1.7.5

* maint-1.7.4:
  make the sample pre-commit hook script reject names with newlines, too
  Reindent closing bracket using tab instead of spaces
  Documentation/git-update-index: refer to 'ls-files'

13 years agoMerge branch 'maint-1.7.3' into maint-1.7.4
Junio C Hamano [Wed, 26 Oct 2011 23:08:08 +0000 (16:08 -0700)] 
Merge branch 'maint-1.7.3' into maint-1.7.4

* maint-1.7.3:
  make the sample pre-commit hook script reject names with newlines, too
  Reindent closing bracket using tab instead of spaces
  Documentation/git-update-index: refer to 'ls-files'

13 years agoMerge branch 'sn/doc-update-index-assume-unchanged' into maint-1.7.3
Junio C Hamano [Wed, 26 Oct 2011 23:08:00 +0000 (16:08 -0700)] 
Merge branch 'sn/doc-update-index-assume-unchanged' into maint-1.7.3

* sn/doc-update-index-assume-unchanged:
  Documentation/git-update-index: refer to 'ls-files'

13 years agoread-cache.c: fix index memory allocation
René Scharfe [Mon, 24 Oct 2011 01:01:27 +0000 (03:01 +0200)] 
read-cache.c: fix index memory allocation

estimate_cache_size() tries to guess how much memory is needed for the
in-memory representation of an index file.  It does that by using the
file size, the number of entries and the difference of the sizes of the
on-disk and in-memory structs -- without having to check the length of
the name of each entry, which varies for each entry, but their sums are
the same no matter the representation.

Except there can be a difference.  First of all, the size is really
calculated by ce_size and ondisk_ce_size based on offsetof(..., name),
not sizeof, which can be different.  And entries are padded with 1 to 8
NULs at the end (after the variable name) to make their total length a
multiple of eight.

So in order to allocate enough memory to hold the index, change the
delta calculation to be based on offsetof(..., name) and round up to
the next multiple of eight.

On a 32-bit Linux, this delta was used before:

sizeof(struct cache_entry)        == 72
sizeof(struct ondisk_cache_entry) == 64
                                    ---
                                      8

The actual difference for an entry with a filename length of one was,
however (find the definitions are in cache.h):

offsetof(struct cache_entry, name)        == 72
offsetof(struct ondisk_cache_entry, name) == 62

ce_size        == (72 + 1 + 8) & ~7 == 80
ondisk_ce_size == (62 + 1 + 8) & ~7 == 64
                                      ---
                                       16

So eight bytes less had been allocated for such entries.  The new
formula yields the correct delta:

(72 - 62 + 7) & ~7 == 16

Reported-by: John Hsing <tsyj2007@gmail.com>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomake the sample pre-commit hook script reject names with newlines, too
Jim Meyering [Sat, 22 Oct 2011 17:44:40 +0000 (19:44 +0200)] 
make the sample pre-commit hook script reject names with newlines, too

The sample pre-commit hook script would fail to reject a file name like
"a\nb" because of the way newlines are handled in "$(...)".  Adjust the
test to count filtered bytes and require there be 0.  Also print all
diagnostics to standard error, not stdout, so they will actually be seen.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint-1.7.3' into maint
Junio C Hamano [Mon, 24 Oct 2011 06:55:22 +0000 (23:55 -0700)] 
Merge branch 'maint-1.7.3' into maint

* maint-1.7.3:
  Reindent closing bracket using tab instead of spaces

13 years agoReindent closing bracket using tab instead of spaces
Nguyễn Thái Ngọc Duy [Mon, 24 Oct 2011 04:24:51 +0000 (15:24 +1100)] 
Reindent closing bracket using tab instead of spaces

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.7.1 v1.7.7.1
Junio C Hamano [Mon, 24 Oct 2011 04:48:06 +0000 (21:48 -0700)] 
Git 1.7.7.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRelNotes/1.7.7.1: setgid bit patch is about fixing "git init" via Makefile setting
Jonathan Nieder [Sat, 22 Oct 2011 11:11:07 +0000 (06:11 -0500)] 
RelNotes/1.7.7.1: setgid bit patch is about fixing "git init" via Makefile setting

The change was actually about "git init -s" which sets the setgid bit on
SysV-style systems to allow shared access to a repository, and can provoke
errors on BSD-style systems, depending on how permissive the filesystem in
use wants to be.

More to the point, the patch was just taking a fix that arrived for
FreeBSD in v1.5.5 days and making it also apply to machines using an
(obscure) GNU userland/FreeBSD kernel mixture.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoAlmost ready for 1.7.7.1
Junio C Hamano [Fri, 21 Oct 2011 18:01:07 +0000 (11:01 -0700)] 
Almost ready for 1.7.7.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'nd/maint-autofix-tag-in-head' into maint
Junio C Hamano [Fri, 21 Oct 2011 17:49:26 +0000 (10:49 -0700)] 
Merge branch 'nd/maint-autofix-tag-in-head' into maint

* nd/maint-autofix-tag-in-head:
  Accept tags in HEAD or MERGE_HEAD
  merge: remove global variable head[]
  merge: use return value of resolve_ref() to determine if HEAD is invalid
  merge: keep stash[] a local variable

Conflicts:
builtin/merge.c

13 years agoMerge branch 'jc/apply-blank-at-eof-fix' into maint
Junio C Hamano [Fri, 21 Oct 2011 17:49:26 +0000 (10:49 -0700)] 
Merge branch 'jc/apply-blank-at-eof-fix' into maint

* jc/apply-blank-at-eof-fix:
  apply --whitespace=error: correctly report new blank lines at end

13 years agoMerge branch 'jn/no-g-plus-s-on-bsd' into maint
Junio C Hamano [Fri, 21 Oct 2011 17:49:25 +0000 (10:49 -0700)] 
Merge branch 'jn/no-g-plus-s-on-bsd' into maint

* jn/no-g-plus-s-on-bsd:
  Makefile: do not set setgid bit on directories on GNU/kFreeBSD

13 years agoMerge branch 'rs/diff-cleanup-records-fix' into maint
Junio C Hamano [Fri, 21 Oct 2011 17:49:25 +0000 (10:49 -0700)] 
Merge branch 'rs/diff-cleanup-records-fix' into maint

* rs/diff-cleanup-records-fix:
  diff: resurrect XDF_NEED_MINIMAL with --minimal
  Revert removal of multi-match discard heuristic in 27af01

13 years agoMerge branch 'il/archive-err-signal' into maint
Junio C Hamano [Fri, 21 Oct 2011 17:49:25 +0000 (10:49 -0700)] 
Merge branch 'il/archive-err-signal' into maint

* il/archive-err-signal:
  Support ERR in remote archive like in fetch/push

13 years agoMerge branch 'js/maint-merge-one-file-osx-expr' into maint
Junio C Hamano [Fri, 21 Oct 2011 17:49:25 +0000 (10:49 -0700)] 
Merge branch 'js/maint-merge-one-file-osx-expr' into maint

* js/maint-merge-one-file-osx-expr:
  merge-one-file: fix "expr: non-numeric argument"

13 years agoMerge branch 'jm/maint-apply-detects-corrupt-patch-header' into maint
Junio C Hamano [Fri, 21 Oct 2011 17:49:24 +0000 (10:49 -0700)] 
Merge branch 'jm/maint-apply-detects-corrupt-patch-header' into maint

* jm/maint-apply-detects-corrupt-patch-header:
  fix "git apply --index ..." not to deref NULL

13 years agoMerge branch 'jc/checkout-from-tree-keep-local-changes' into maint
Junio C Hamano [Fri, 21 Oct 2011 17:49:24 +0000 (10:49 -0700)] 
Merge branch 'jc/checkout-from-tree-keep-local-changes' into maint

* jc/checkout-from-tree-keep-local-changes:
  checkout $tree $path: do not clobber local changes in $path not in $tree

13 years agoMerge branch 'mm/maint-config-explicit-bool-display' into maint
Junio C Hamano [Fri, 21 Oct 2011 17:49:24 +0000 (10:49 -0700)] 
Merge branch 'mm/maint-config-explicit-bool-display' into maint

* mm/maint-config-explicit-bool-display:
  config: display key_delim for config --bool --get-regexp

13 years agostrbuf.c: remove unnecessary strbuf_grow() from strbuf_getwholeline()
Brandon Casey [Thu, 6 Oct 2011 04:21:33 +0000 (23:21 -0500)] 
strbuf.c: remove unnecessary strbuf_grow() from strbuf_getwholeline()

This use of strbuf_grow() is a historical artifact that was once used to
ensure that strbuf.buf was allocated and properly nul-terminated.  This
was added before the introduction of the slopbuf in b315c5c0, which
guarantees that strbuf.buf always points to a usable nul-terminated string.
So let's remove it.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoPrepare for 1.7.7.1
Junio C Hamano [Sun, 16 Oct 2011 03:55:12 +0000 (20:55 -0700)] 
Prepare for 1.7.7.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'ms/patch-id-with-overlong-line' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:39 +0000 (20:46 -0700)] 
Merge branch 'ms/patch-id-with-overlong-line' into maint

* ms/patch-id-with-overlong-line:
  patch-id.c: use strbuf instead of a fixed buffer

13 years agoMerge branch 'jc/maint-bundle-too-quiet' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:39 +0000 (20:46 -0700)] 
Merge branch 'jc/maint-bundle-too-quiet' into maint

* jc/maint-bundle-too-quiet:
  Teach progress eye-candy to fetch_refs_from_bundle()

13 years agoMerge branch 'jk/filter-branch-require-clean-work-tree' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:38 +0000 (20:46 -0700)] 
Merge branch 'jk/filter-branch-require-clean-work-tree' into maint

* jk/filter-branch-require-clean-work-tree:
  filter-branch: use require_clean_work_tree

13 years agoMerge branch 'jc/maint-fsck-fwrite-size-check' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:38 +0000 (20:46 -0700)] 
Merge branch 'jc/maint-fsck-fwrite-size-check' into maint

* jc/maint-fsck-fwrite-size-check:
  fsck: do not abort upon finding an empty blob

13 years agoMerge branch 'bk/ancestry-path' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:38 +0000 (20:46 -0700)] 
Merge branch 'bk/ancestry-path' into maint

* bk/ancestry-path:
  t6019: avoid refname collision on case-insensitive systems
  revision: do not include sibling history in --ancestry-path output
  revision: keep track of the end-user input from the command line
  rev-list: Demonstrate breakage with --ancestry-path --all

13 years agoMerge branch 'jk/maint-fetch-submodule-check-fix' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:38 +0000 (20:46 -0700)] 
Merge branch 'jk/maint-fetch-submodule-check-fix' into maint

* jk/maint-fetch-submodule-check-fix:
  fetch: avoid quadratic loop checking for updated submodules

13 years agoMerge branch 'tr/mergetool-valgrind' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:37 +0000 (20:46 -0700)] 
Merge branch 'tr/mergetool-valgrind' into maint

* tr/mergetool-valgrind:
  Symlink mergetools scriptlets into valgrind wrappers

13 years agoMerge branch 'nm/grep-object-sha1-lock' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:37 +0000 (20:46 -0700)] 
Merge branch 'nm/grep-object-sha1-lock' into maint

* nm/grep-object-sha1-lock:
  grep: Fix race condition in delta_base_cache

Conflicts:
builtin/grep.c

13 years agoMerge branch 'jc/diff-index-unpack' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:36 +0000 (20:46 -0700)] 
Merge branch 'jc/diff-index-unpack' into maint

* jc/diff-index-unpack:
  diff-index: pass pathspec down to unpack-trees machinery
  unpack-trees: allow pruning with pathspec
  traverse_trees(): allow pruning with pathspec

13 years agoMerge branch 'mm/rebase-i-exec-edit' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:36 +0000 (20:46 -0700)] 
Merge branch 'mm/rebase-i-exec-edit' into maint

* mm/rebase-i-exec-edit:
  rebase -i: notice and warn if "exec $cmd" modifies the index or the working tree
  rebase -i: clean error message for --continue after failed exec

13 years agot1304: fall back to $USER if $LOGNAME is not defined
René Scharfe [Fri, 14 Oct 2011 17:44:45 +0000 (19:44 +0200)] 
t1304: fall back to $USER if $LOGNAME is not defined

For some reason $LOGNAME is not set anymore for me after an upgrade from
Ubuntu 11.04 to 11.10.  Use $USER in such a case.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofix "git apply --index ..." not to deref NULL
Jim Meyering [Wed, 12 Oct 2011 14:33:54 +0000 (16:33 +0200)] 
fix "git apply --index ..." not to deref NULL

I noticed this when "git am CORRUPTED" unexpectedly failed with an
odd diagnostic, and even removed one of the files it was supposed
to have patched.

Reproduce with any valid old/new patch from which you have removed
the "+++ b/FILE" line.  You'll see a diagnostic like this

    fatal: unable to write file '(null)' mode 100644: Bad address

and you'll find that FILE has been removed.

The above is on glibc-based systems.  On other systems, rather than
getting "null", you may provoke a segfault as git tries to
dereference the NULL file name.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoconfig: display key_delim for config --bool --get-regexp
Matthieu Moy [Mon, 10 Oct 2011 12:54:51 +0000 (14:54 +0200)] 
config: display key_delim for config --bool --get-regexp

The previous logic in show_config was to print the delimiter when the
value was set, but Boolean variables have an implicit value "true" when
they appear with no value in the config file. As a result, we got:

git_Config        --get-regexp '.*\.Boolean' #1. Ok: example.boolean
git_Config --bool --get-regexp '.*\.Boolean' #2. NO: example.booleantrue

Fix this by defering the display of the separator until after the value
to display has been computed.

Reported-by: Brian Foster <brian.foster@maxim-ic.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomerge-one-file: fix "expr: non-numeric argument"
Jay Soffian [Thu, 6 Oct 2011 18:25:55 +0000 (14:25 -0400)] 
merge-one-file: fix "expr: non-numeric argument"

When invoking expr to compare two numbers, don't quote the
variables which are the output of 'wc -c'. On OS X, this output
includes spaces, which expr balks at:

  $ sz0=`wc -c </etc/passwd`
  $ sz1=`wc -c </etc/passwd`
  $ echo "'$sz0'"
  '    3667'

  $ expr "$sz0" \< "$sz1" \* 2
  expr: non-numeric argument

  $ expr $sz0 \< $sz1 \* 2
  1

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoSupport ERR in remote archive like in fetch/push
Ilari Liusvaara [Mon, 3 Oct 2011 11:01:59 +0000 (14:01 +0300)] 
Support ERR in remote archive like in fetch/push

Make ERR as first packet of remote snapshot reply work like it does in
fetch/push. Lets servers decline remote snapshot with message the same
way as declining fetch/push with a message.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMakefile: do not set setgid bit on directories on GNU/kFreeBSD
Jonathan Nieder [Mon, 3 Oct 2011 06:41:20 +0000 (01:41 -0500)] 
Makefile: do not set setgid bit on directories on GNU/kFreeBSD

The g+s bit on directories to make group ownership inherited is a
SysVism --- BSD and most of its descendants do not need it since they
do the sane thing by default without g+s.  In fact, on some
filesystems (but not all --- tmpfs works this way but UFS does not),
the kernel of FreeBSD does not even allow non-root users to set setgid
bit on directories and produces errors when one tries:

$ git init --shared dir
fatal: Could not make /tmp/dir/.git/refs writable by group

Since the setgid bit would only mean "do what you were going to do
already", it's better to avoid setting it.  Accordingly, ever since
v1.5.5-rc0~59^2 (Do not use GUID on dir in git init --share=all on
FreeBSD, 2008-03-05), git on true FreeBSD has done exactly that.  Set
DIR_HAS_BSD_GROUP_SEMANTICS in the makefile for GNU/kFreeBSD, too, so
machines that use glibc with the kernel of FreeBSD get the same fix.

This fixes t0001-init.sh and t1301-shared-repo.sh on GNU/kFreeBSD
when running tests with --root pointing to a directory that uses
tmpfs.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff: resurrect XDF_NEED_MINIMAL with --minimal
Junio C Hamano [Sun, 2 Oct 2011 04:56:28 +0000 (21:56 -0700)] 
diff: resurrect XDF_NEED_MINIMAL with --minimal

Earlier, 582aa00 (git diff too slow for a file, 2010-05-02)
unconditionally dropped XDF_NEED_MINIMAL option from the internal xdiff
invocation to help performance on pathological cases, while hinting that a
follow-up patch could reintroduce it with "--minimal" option from the
command line.

Make it so.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.7 v1.7.7
Junio C Hamano [Fri, 30 Sep 2011 21:20:57 +0000 (14:20 -0700)] 
Git 1.7.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocheckout $tree $path: do not clobber local changes in $path not in $tree
Junio C Hamano [Fri, 30 Sep 2011 17:33:15 +0000 (10:33 -0700)] 
checkout $tree $path: do not clobber local changes in $path not in $tree

Checking paths out of a tree is (currently) defined to do:

 - Grab the paths from the named tree that match the given pathspec,
   and add them to the index;

 - Check out the contents from the index for paths that match the
   pathspec to the working tree; and while at it

 - If the given pathspec did not match anything, suspect a typo from the
   command line and error out without updating the index nor the working
   tree.

Suppose that the branch you are working on has dir/myfile, and the "other"
branch has dir/other but not dir/myfile. Further imagine that you have
either modified or removed dir/myfile in your working tree, but you have
not run "git add dir/myfile" or "git rm dir/myfile" to tell Git about your
local change. Running

 $ git checkout other dir

would add dir/other to the index with the contents taken out of the
"other" branch, and check out the paths from the index that match the
pathspec "dir", namely, "dir/other" and "dir/myfile", overwriting your
local changes to "dir/myfile", even though "other" branch does not even
know about that file.

Fix it by updating the working tree only with the index entries that
was read from the "other" tree.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotemplates/hooks--*: remove sample hooks without any functionality
Gerrit Pape [Tue, 27 Sep 2011 11:56:53 +0000 (11:56 +0000)] 
templates/hooks--*: remove sample hooks without any functionality

Remove the sample post-commit and post-receive hooks.  The sample
post-commit doesn't contain any sample functionality and the comments do
not provide more information than already found in the documentation.
The sample post-receive hooks doesn't provide any sample functionality
either and refers in the comments to a contrib hook that might be
installed in different locations on different systems, which isn't that
helpful.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agonotes_merge_commit(): do not pass temporary buffer to other function
Michael Haggerty [Tue, 27 Sep 2011 04:46:53 +0000 (06:46 +0200)] 
notes_merge_commit(): do not pass temporary buffer to other function

It is unsafe to pass a temporary buffer as an argument to
read_directory().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Fix links to lines in blobs when javascript-actions are enabled
Peter Stuge [Tue, 27 Sep 2011 09:51:00 +0000 (11:51 +0200)] 
gitweb: Fix links to lines in blobs when javascript-actions are enabled

The fixLinks() function adds 'js=1' to each link that does not already
have 'js' query parameter specified. This is used to signal to gitweb
that the browser can actually do javascript when these links are used.

There are two problems with the existing code:

  1. URIs with fragment and 'js' query parameter, like e.g.

        ...foo?js=0#l199

     were not recognized as having 'js' query parameter already.

  2. The 'js' query parameter, in the form of either '?js=1' or ';js=1'
     was appended at the end of URI, even if it included a fragment
     (had a hash part).  This lead to the incorrect links like this

        ...foo#l199?js=1

     instead of adding query parameter as last part of query, but
     before the fragment part, i.e.

        ...foo?js=1#l199

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocontrib/hooks: adapt comment about Debian install location for contrib hooks
Gerrit Pape [Mon, 26 Sep 2011 12:58:35 +0000 (12:58 +0000)] 
contrib/hooks: adapt comment about Debian install location for contrib hooks

Placing the contrib hooks into /usr/share/doc/ wasn't a good idea in the
first place.  According to the Debian policy they should be located in
/usr/share/git-core/, so let's put them there.

Thanks to Bill Allombert for reporting this through
 http://bugs.debian.org/640949

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoapply --whitespace=error: correctly report new blank lines at end
Junio C Hamano [Mon, 26 Sep 2011 20:30:30 +0000 (13:30 -0700)] 
apply --whitespace=error: correctly report new blank lines at end

Earlier, 77b15bb (apply --whitespace=warn/error: diagnose blank at EOF,
2009-09-03) cheated by reporting the line number of the hunk that contains
the offending line that adds new blank lines at the end of the file. All
other types of whitespace errors are reported with the line number in the
patch file that has the actual offending text.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRevert removal of multi-match discard heuristic in 27af01
René Scharfe [Sun, 25 Sep 2011 13:39:08 +0000 (21:39 +0800)] 
Revert removal of multi-match discard heuristic in 27af01

27af01d (xdiff/xprepare: improve O(n*m) performance in
xdl_cleanup_records(), 2011-08-17) was supposed to be a performance
boost only. However, it unexpectedly changed the behaviour of diff.

Revert a part of 27af01d that removes logic that mark lines as
"multi-match" (ie. dis[i] == 2). This was preventing the multi-match
discard heuristic (performed in xdl_cleanup_records() and
xdl_clean_mmatch()) from executing.

Reported-by: Alexander Pepper <pepper@inf.fu-berlin.de>
Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/namespace-doc-with-old-asciidoc'
Junio C Hamano [Mon, 26 Sep 2011 17:50:08 +0000 (10:50 -0700)] 
Merge branch 'jc/namespace-doc-with-old-asciidoc'

* jc/namespace-doc-with-old-asciidoc:
  Documentation/gitnamespaces.txt: cater to older asciidoc

13 years agogit-read-tree.txt: update sparse checkout examples
Nguyễn Thái Ngọc Duy [Sun, 25 Sep 2011 23:09:15 +0000 (09:09 +1000)] 
git-read-tree.txt: update sparse checkout examples

The negation example uses '*' to match everything. This used to work
before 9037026 (unpack-trees: fix sparse checkout's "unable to match
directories") because back then, the list of paths is used to match
sparse patterns, so with the patterns

    *
    !subdir/

subdir/ always matches any path that start with subdir/ and "*" has no
chance to get tested. The result is subdir is excluded.

After the said commit, a tree structure is dynamically created and
sparse pattern matching now follows closely how read_directory()
applies .gitignore. This solves one problem, but reveals another one.

With this new strategy, "!subdir/" rule will be only tested once when
"subdir" directory is examined. Entries inside subdir, when examined,
will match "*" and are (correctly) re-added again because any rules
without a slash will match at every directory level. In the end, "*"
can revert every negation rules.

In order to correctly exclude subdir, we must use

    /*
    !subdir

to limit "match all" rule at top level only.

"*" rule has no actual use in sparse checkout and can be confusing to
users. While we can automatically turn "*" to "/*", this violates
.gitignore definition. Instead, discourage "*" in favor of "/*" (in
the second example).

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomergetool: no longer need to save standard input
Junio C Hamano [Fri, 16 Sep 2011 20:19:33 +0000 (13:19 -0700)] 
mergetool: no longer need to save standard input

Earlier code wanted to run merge_file and prompt_after_failed_merge
both of which wanted to read from the standard input of the entire
script inside a while loop, which read from a pipe, and in order to
do so, it redirected the original standard input to another file
descriptor. We no longer need to do so after the previous change.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomergetool: Use args as pathspec to unmerged files
Jonathon Mah [Fri, 16 Sep 2011 02:12:10 +0000 (19:12 -0700)] 
mergetool: Use args as pathspec to unmerged files

Mergetool now treats its path arguments as a pathspec (like other git
subcommands), restricting action to the given files and directories.
Files matching the pathspec are filtered so mergetool only acts on
unmerged paths; previously it would assume each path argument was in an
unresolved state, and get confused when it couldn't check out their
other stages.

Running "git mergetool subdir" will prompt to resolve all conflicted
blobs under subdir.

Signed-off-by: Jonathon Mah <me@JonathonMah.com>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.7-rc3 v1.7.7-rc3
Junio C Hamano [Fri, 23 Sep 2011 22:35:57 +0000 (15:35 -0700)] 
Git 1.7.7-rc3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge 1.7.6.4 in
Junio C Hamano [Fri, 23 Sep 2011 22:31:08 +0000 (15:31 -0700)] 
Merge 1.7.6.4 in

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomerge-recursive: Do not look at working tree during a virtual ancestor merge
Junio C Hamano [Fri, 23 Sep 2011 22:21:01 +0000 (15:21 -0700)] 
merge-recursive: Do not look at working tree during a virtual ancestor merge

Fix another instance of a recursive merge incorrectly paying attention to
the working tree file during a virtual ancestor merge, that resulted in
spurious and useless "addinfo_cache failed" error message.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.6.4 v1.7.6.4
Junio C Hamano [Fri, 23 Sep 2011 21:38:39 +0000 (14:38 -0700)] 
Git 1.7.6.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'cb/maint-ls-files-error-report' into maint
Junio C Hamano [Fri, 23 Sep 2011 21:30:49 +0000 (14:30 -0700)] 
Merge branch 'cb/maint-ls-files-error-report' into maint

* cb/maint-ls-files-error-report:
  t3005: do not assume a particular order of stdout and stderr of git-ls-files
  ls-files: fix pathspec display on error

13 years agodescribe: Refresh the index when run with --dirty
Allan Caffee [Mon, 1 Aug 2011 01:52:41 +0000 (21:52 -0400)] 
describe: Refresh the index when run with --dirty

When running git describe --dirty the index should be refreshed.  Previously
the cached index would cause describe to think that the index was dirty when,
in reality, it was just stale.

The issue was exposed by python setuptools which hardlinks files into another
directory when building a distribution.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/maint-clone-alternates' into maint
Junio C Hamano [Fri, 23 Sep 2011 21:27:33 +0000 (14:27 -0700)] 
Merge branch 'jc/maint-clone-alternates' into maint

* jc/maint-clone-alternates:
  clone: clone from a repository with relative alternates
  clone: allow more than one --reference

13 years agoMerge branch 'nd/maint-clone-gitdir' into maint
Junio C Hamano [Fri, 23 Sep 2011 21:21:39 +0000 (14:21 -0700)] 
Merge branch 'nd/maint-clone-gitdir' into maint

* nd/maint-clone-gitdir:
  clone: allow to clone from .git file
  read_gitfile_gently(): rename misnamed function to read_gitfile()

13 years agoMerge branch 'mh/check-ref-format-print-normalize' into maint
Junio C Hamano [Fri, 23 Sep 2011 21:20:51 +0000 (14:20 -0700)] 
Merge branch 'mh/check-ref-format-print-normalize' into maint

* mh/check-ref-format-print-normalize:
  Forbid DEL characters in reference names
  check-ref-format --print: Normalize refnames that start with slashes

13 years agoMerge branch 'mg/branch-set-upstream-previous' into maint
Junio C Hamano [Fri, 23 Sep 2011 21:16:22 +0000 (14:16 -0700)] 
Merge branch 'mg/branch-set-upstream-previous' into maint

* mg/branch-set-upstream-previous:
  branch.c: use the parsed branch name

13 years agoMerge branch 'gb/maint-am-patch-format-error-message' into maint
Junio C Hamano [Fri, 23 Sep 2011 21:11:18 +0000 (14:11 -0700)] 
Merge branch 'gb/maint-am-patch-format-error-message' into maint

* gb/maint-am-patch-format-error-message:
  am: format is in $patch_format, not parse_patch

13 years agopatch-id.c: use strbuf instead of a fixed buffer
Michael Schubert [Wed, 21 Sep 2011 12:42:22 +0000 (14:42 +0200)] 
patch-id.c: use strbuf instead of a fixed buffer

get_one_patchid() uses a rather dumb heuristic to determine if the
passed buffer is part of the next commit. Whenever the first 40 bytes
are a valid hexadecimal sha1 representation, get_one_patchid() returns
next_sha1.

Once the current line is longer than the fixed buffer, this will break
(provided the additional bytes make a valid hexadecimal sha1). As a result
patch-id returns incorrect results. Instead, use strbuf and read one line
at a time.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Schubert <mschub@elegosoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-read-tree.txt: correct sparse-checkout and skip-worktree description
Michael J Gruber [Wed, 21 Sep 2011 07:48:38 +0000 (09:48 +0200)] 
git-read-tree.txt: correct sparse-checkout and skip-worktree description

The description of .git/info/sparse-checkout and
skip-worktree is exactly the opposite of what is true, which is:

If a file matches a pattern in sparse-checkout, then (it is to be
checked out and therefore) skip-worktree is unset for that file;
otherwise, it is set (so that it is not checked out).

Currently, the opposite is documented, and (consistently) read-tree's
behavior with respect to bit flips is descibed incorrectly.

Fix it.

In hindsight, it would have been much better to have a "sparse-ignore"
or "sparse-skip" file so that an empty file would mean a full checkout,
and the file logic would be analogous to that of .gitignore, excludes
and skip-worktree.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-read-tree.txt: language and typography fixes
Michael J Gruber [Wed, 21 Sep 2011 07:48:37 +0000 (09:48 +0200)] 
git-read-tree.txt: language and typography fixes

Fix a few missing articles and such, and mark-up 'commands' and `files`
appropriately.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agounpack-trees: print "Aborting" to stderr
Michael J Gruber [Wed, 21 Sep 2011 07:48:36 +0000 (09:48 +0200)] 
unpack-trees: print "Aborting" to stderr

display_error_msgs() prints all the errors to stderr already (if any),
followed by "Aborting" (if any) to stdout. Make the latter go to stderr
instead.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRemove 'working copy' from the documentation and C code
Carlos Martín Nieto [Tue, 20 Sep 2011 20:25:57 +0000 (22:25 +0200)] 
Remove 'working copy' from the documentation and C code

The git term is 'working tree', so replace the most public references
to 'working copy'.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot9159-*.sh: skip for mergeinfo test for svn <= 1.4
Ramsay Jones [Sat, 10 Sep 2011 17:40:10 +0000 (18:40 +0100)] 
t9159-*.sh: skip for mergeinfo test for svn <= 1.4

t9159 relies on the command-line syntax of svn >= 1.5.  Given the
declining install base of older svn versions, it is not worth our time to
support older svn syntax.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation/git-update-index: refer to 'ls-files'
Stefan Naewe [Wed, 21 Sep 2011 06:21:50 +0000 (08:21 +0200)] 
Documentation/git-update-index: refer to 'ls-files'

'ls-files' refers to 'update-index' to show how the 'assume unchanged'
bit can be seen. This makes the connection 'bi-directional'.

Signed-off-by: Stefan Naewe <stefan.naewe@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Tue, 20 Sep 2011 03:46:48 +0000 (20:46 -0700)] 
Merge branch 'maint'

* maint:
  git-mergetool: check return value from read

13 years agogit-mergetool: check return value from read
Jay Soffian [Mon, 19 Sep 2011 23:40:52 +0000 (19:40 -0400)] 
git-mergetool: check return value from read

Mostly fixed already by 6b44577 (mergetool: check return value
from read, 2011-07-01). Catch two uses it missed.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'ph/format-patch-no-color'
Junio C Hamano [Mon, 19 Sep 2011 20:15:41 +0000 (13:15 -0700)] 
Merge branch 'ph/format-patch-no-color'

* ph/format-patch-no-color:
  t4014: clean up format.thread config after each test

13 years agot4014: clean up format.thread config after each test
Jeff King [Mon, 19 Sep 2011 19:15:45 +0000 (15:15 -0400)] 
t4014: clean up format.thread config after each test

The threading tests turn on format.thread, but never clean
up after themselves, meaning that later tests will also have
format.thread set.

This is more annoying than most leftover config, too,
because not only does it impact the results of other tests,
but it does so non-deterministically. Threading requires the
generation of message-ids, which incorporate the current
time, meaning a slow-running test script may generate
different results from run to run.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoTeach progress eye-candy to fetch_refs_from_bundle()
Junio C Hamano [Sun, 18 Sep 2011 23:52:32 +0000 (16:52 -0700)] 
Teach progress eye-candy to fetch_refs_from_bundle()

With the usual "git" transport, a large-ish transfer with "git fetch" and
"git pull" give progress eye-candy to avoid boring users.  However, not
when they are reading from a bundle. I.e.

    $ git pull ../git-bundle.bndl master

This teaches bundle.c:unbundle() to give "-v" option to index-pack and
tell it to give progress bar when transport decides it is necessary.

The operation in the other direction, "git bundle create", could also
learn to honor --quiet but that is a separate issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.7-rc2 v1.7.7-rc2
Junio C Hamano [Sun, 18 Sep 2011 22:41:34 +0000 (15:41 -0700)] 
Git 1.7.7-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoAccept tags in HEAD or MERGE_HEAD
Nguyễn Thái Ngọc Duy [Sat, 17 Sep 2011 11:57:45 +0000 (21:57 +1000)] 
Accept tags in HEAD or MERGE_HEAD

HEAD and MERGE_HEAD (among other branch tips) should never hold a
tag. That can only be caused by broken tools and is cumbersome to fix
by an end user with:

  $ git update-ref HEAD $(git rev-parse HEAD^{commit})

which may look like a magic to a new person.

Be easy, warn users (so broken tools can be fixed if they bother to
report) and move on.

Be robust, if the given SHA-1 cannot be resolved to a commit object,
die (therefore return value is always valid).

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomerge: remove global variable head[]
Nguyễn Thái Ngọc Duy [Sat, 17 Sep 2011 11:57:44 +0000 (21:57 +1000)] 
merge: remove global variable head[]

Also kill head_invalid in favor of "head_commit == NULL".

Local variable "head" in cmd_merge() is renamed to "head_sha1" to make
sure I don't miss any access because this variable should not be used
after head_commit is set (use head_commit->object.sha1 instead).

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomerge: use return value of resolve_ref() to determine if HEAD is invalid
Nguyễn Thái Ngọc Duy [Sat, 17 Sep 2011 11:57:43 +0000 (21:57 +1000)] 
merge: use return value of resolve_ref() to determine if HEAD is invalid

resolve_ref() only updates "head" when it returns non NULL value (it
may update "head" even when returning NULL, but not in all cases).

Because "head" is not initialized before the call, is_null_sha1() is
not enough. Check also resolve_ref() return value.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'ci/forbid-unwanted-current-branch-update'
Junio C Hamano [Sat, 17 Sep 2011 04:48:10 +0000 (21:48 -0700)] 
Merge branch 'ci/forbid-unwanted-current-branch-update'

* ci/forbid-unwanted-current-branch-update:
  branch --set-upstream: regression fix

13 years agobranch --set-upstream: regression fix
Junio C Hamano [Fri, 16 Sep 2011 23:28:38 +0000 (16:28 -0700)] 
branch --set-upstream: regression fix

The "git branch" command, while not in listing mode, calls create_branch()
even when the target branch already exists, and it does so even when it is
not interested in updating the value of the branch (i.e. the name of the
commit object that sits at the tip of the existing branch). This happens
when the command is run with "--set-upstream" option.

The earlier safety-measure to prevent "git branch -f $branch $commit" from
updating the currently checked out branch did not take it into account,
and we no longer can update the tracking information of the current branch.

Minimally fix this regression by telling the validation code if it is
called to really update the value of a potentially existing branch, or if
the caller merely is interested in updating auxiliary aspects of a branch.

Reported-and-Tested-by: Jay Soffian
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDisambiguate duplicate t9160* tests
Frédéric Heitzmann [Fri, 16 Sep 2011 19:55:03 +0000 (21:55 +0200)] 
Disambiguate duplicate t9160* tests

1e5814f created t9160-git-svn-mergeinfo-push.sh on 11/9/7
40a1530 created t9160-git-svn-preserve-empty-dirs.sh on 11/7/20
The former test script is renumbered to t9161.

Signed-off-by: Frédéric Heitzmann <frederic.heitzmann@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Strip non-printable characters from syntax highlighter output
Jakub Narebski [Fri, 16 Sep 2011 12:41:57 +0000 (14:41 +0200)] 
gitweb: Strip non-printable characters from syntax highlighter output

The current code, as is, passes control characters, such as form-feed
(^L) to highlight which then passes it through to the browser.  User
agents (web browsers) that support 'application/xhtml+xml' usually
require that web pages declared as XHTML and with this mimetype are
well-formed XML.  Unescaped control characters cannot appear within a
contents of a valid XML document.

This will cause the browser to display one of the following warnings:

* Safari v5.1 (6534.50) & Google Chrome v13.0.782.112:

   This page contains the following errors:

   error on line 657 at column 38: PCDATA invalid Char value 12
   Below is a rendering of the page up to the first error.

* Mozilla Firefox 3.6.19 & Mozilla Firefox 5.0:

   XML Parsing Error: not well-formed
   Location:
   http://path/to/git/repo/blah/blah

Both errors were generated by gitweb.perl v1.7.3.4 w/ highlight 2.7
using arch/ia64/kernel/unwind.c from the Linux kernel.

When syntax highlighter is not used, control characters are replaced
by esc_html(), but with syntax highlighter they were passed through to
browser (to_utf8() doesn't remove control characters).

Introduce sanitize() subroutine which strips forbidden characters, but
does not perform HTML escaping, and use it in git_blob() to sanitize
syntax highlighter output for XHTML.

Note that excluding "\t" (U+0009), "\n" (U+000A) and "\r" (U+000D) is
not strictly necessary, atleast for currently the only callsite: "\t"
tabs are replaced by spaces by untabify(), "\n" is stripped from each
line before processing it, and replacing "\r" could be considered
improvement.

Originally-by: Christopher M. Fuhrman <cfuhrman@panix.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>