1
0
mirror of https://github.com/git/git.git synced 2024-10-23 06:19:22 +02:00
Commit Graph

31491 Commits

Author SHA1 Message Date
Nguyễn Thái Ngọc Duy
712efb1a42 attr: make it build with DEBUG_ATTR again
Commit 82dce99 (attr: more matching optimizations from .gitignore -
2012-10-15) changed match_attr structure but it did not update
DEBUG_ATTR-specific code. This fixes it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-15 10:02:08 -08:00
Nguyễn Thái Ngọc Duy
711536bd4b attr: fix off-by-one directory component length calculation
94bc671 (Add directory pattern matching to attributes - 2012-12-08)
uses find_basename() to calculate the length of directory part in
prepare_attr_stack. This function expects the directory without the
trailing slash (as "origin" field in match_attr struct is without the
trailing slash). find_basename() includes the trailing slash and
confuses push/pop algorithm.

Consider path = "abc/def" and the push down code:

	while (1) {
		len = strlen(attr_stack->origin);
		if (dirlen <= len)
			break;
		cp = memchr(path + len + 1, '/', dirlen - len - 1);
		if (!cp)
			cp = path + dirlen;

dirlen is 4, not 3, without this patch. So when attr_stack->origin is
"abc", it'll miss the exit condition because 4 <= 3 is wrong. It'll
then try to push "abc/" down the attr stack (because "cp" would be
NULL). So we have both "abc" and "abc/" in the stack.

Next time when "abc/ghi" is checked, "abc/" is popped out because of
the off-by-one dirlen, only to be pushed back in again by the above
code. This repeats for all files in the same directory. Which means
at least one failed open syscall per file, or more if .gitattributes
exists.

This is the perf result with 10 runs on git.git:

Test                                     94bc671^          94bc671                   HEAD
----------------------------------------------------------------------------------------------------------
7810.1: grep worktree, cheap regex       0.02(0.01+0.04)   0.05(0.03+0.05) +150.0%   0.02(0.01+0.04) +0.0%
7810.2: grep worktree, expensive regex   0.25(0.94+0.01)   0.26(0.94+0.02) +4.0%     0.25(0.93+0.02) +0.0%
7810.3: grep --cached, cheap regex       0.11(0.10+0.00)   0.12(0.10+0.02) +9.1%     0.10(0.10+0.00) -9.1%
7810.4: grep --cached, expensive regex   0.61(0.60+0.01)   0.62(0.61+0.01) +1.6%     0.61(0.60+0.00) +0.0%

Reported-by: Ross Lagerwall <rosslagerwall@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-15 08:17:23 -08:00
Phil Hord
986977847e rebase --preserve-merges: keep all merge commits including empty ones
Since 90e1818f9a  (git-rebase: add keep_empty flag, 2012-04-20)
'git rebase --preserve-merges' fails to preserve empty merge commits
unless --keep-empty is also specified.  Merge commits should be
preserved in order to preserve the structure of the rebased graph,
even if the merge commit does not introduce changes to the parent.

Teach rebase not to drop merge commits only because they are empty.

A special case which is not handled by this change is for a merge commit
whose parents are now the same commit because all the previous different
parents have been dropped as a result of this rebase or some previous
operation.

Signed-off-by: Phil Hord <hordp@cisco.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-14 09:15:39 -08:00
Zoltan Klinger
f538a91e3c git-clean: Display more accurate delete messages
(1) Only print out the names of the files and directories that got
    actually deleted. Also do not mention that we are not removing
    directories when the user did not ask us to do so with '-d'.
(2) Show ignore message for skipped untracked git repositories.

Consider the following repo layout:

  test.git/
    |-- tracked_dir/
    |     |-- some_tracked_file
    |     |-- some_untracked_file
    |-- tracked_file
    |-- untracked_file
    |-- untracked_foo/
    |     |-- bar/
    |     |     |-- bar.txt
    |     |-- emptydir/
    |     |-- frotz.git/
    |           |-- frotz.tx
    |-- untracked_some.git/
          |-- some.txt

Suppose the user issues 'git clean -fd' from the test.git directory.

When -d option is used and untracked directory 'foo' contains a
subdirectory 'frotz.git' that is managed by a different git repository
therefore it will not be removed.

  $ git clean -fd
  Removing tracked_dir/some_untracked_file
  Removing untracked_file
  Removing untracked_foo/
  Removing untracked_some.git/

The message displayed to the user is slightly misleading. The foo/
directory has not been removed because of foo/frotz.git still exists.
On the other hand the subdirectories 'bar' and 'emptydir' have been
deleted but they're not mentioned anywhere. Also, untracked_some.git
has not been removed either.

This behaviour is the result of the way the deletion of untracked
directories are reported. In the current implementation they are
deleted recursively but only the name of the top most directory is
printed out. The calling function does not know about any
subdirectories that could not be removed during the recursion.

Improve the way the deleted directories are reported back to
the user:
  (1) Create a recursive delete function 'remove_dirs' in builtin/clean.c
      to run in both dry_run and delete modes with the delete logic as
      follows:
        (a) Check if the current directory to be deleted is an untracked
            git repository. If it is and --force --force option is not set
            do not touch this directory, print ignore message, set dir_gone
            flag to false for the caller and return.
        (b) Otherwise for each item in current directory:
              (i)   If current directory cannot be accessed, print warning,
                    set dir_gone flag to false and return.
              (ii)  If the item is a subdirectory recurse into it,
                    check for the returned value of the dir_gone flag.
                    If the subdirectory is gone, add the name of the deleted
                    directory to a list of successfully removed items 'dels'.
                    Else set the dir_gone flag as the current directory
                    cannot be removed because we have at least one subdirectory
                    hanging around.
              (iii) If it is a file try to remove it. If success add the
                    file name to the 'dels' list, else print error and set
                    dir_gone flag to false.
        (c) After we finished deleting all items in the current directory and
            the dir_gone flag is still true, remove the directory itself.
            If failed set the dir_gone flag to false.

        (d) If the current directory cannot be deleted because the dir_gone flag
            has been set to false, print out all the successfully deleted items
            for this directory from the 'dels' list.
        (e) We're done with the current directory, return.

  (2) Modify the cmd_clean() function to:
        (a) call the recursive delete function 'remove_dirs()' for each
            topmost directory it wants to remove
        (b) check for the returned value of dir_gone flag. If it's true
            print the name of the directory as being removed.

Consider the output of the improved version:

  $ git clean -fd
  Removing tracked_dir/some_untracked_file
  Removing untracked_file
  Skipping repository untracked_foo/frotz.git
  Removing untracked_foo/bar
  Removing untracked_foo/emptydir
  Skipping repository untracked_some.git/

Now it displays only the file and directory names that got actually
deleted and shows the name of the untracked git repositories it ignored.

Reported-by: Soren Brinkmann <soren.brinkmann@xilinx.com>

Signed-off-by: Zoltan Klinger <zoltan.klinger@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-14 08:55:36 -08:00
Junio C Hamano
e4f59a32de Git 1.8.1.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.8.1.1
2013-01-14 08:04:50 -08:00
Junio C Hamano
dca93d2b01 Merge branch 'jk/complete-commit-c' into maint
* jk/complete-commit-c:
  completion: complete refs for "git commit -c"
2013-01-14 08:02:35 -08:00
Junio C Hamano
750a6cacf4 Merge branch 'jk/unify-exit-code-by-receiving-signal' into maint
* jk/unify-exit-code-by-receiving-signal:
  run-command: encode signal death as a positive integer
2013-01-14 08:01:27 -08:00
Junio C Hamano
32a03dc165 Merge branch 'jn/xml-depends-on-asciidoc-conf' into maint
* jn/xml-depends-on-asciidoc-conf:
  docs: manpage XML depends on asciidoc.conf
2013-01-14 08:01:00 -08:00
Junio C Hamano
267aaa08e2 Merge branch 'jk/maint-fast-import-doc-reorder' into maint
* jk/maint-fast-import-doc-reorder:
  git-fast-import(1): reorganise options
  git-fast-import(1): combine documentation of --[no-]relative-marks
2013-01-14 07:59:46 -08:00
Junio C Hamano
74abc17f91 Merge branch 'jk/shortlog-no-wrap-doc' into maint
* jk/shortlog-no-wrap-doc:
  git-shortlog(1): document behaviour of zero-width wrap
2013-01-14 07:59:03 -08:00
Junio C Hamano
7b9ea42b3c Merge branch 'jk/maint-fast-import-doc-dedup-done' into maint
* jk/maint-fast-import-doc-dedup-done:
  git-fast-import(1): remove duplicate '--done' option
2013-01-14 07:48:39 -08:00
Junio C Hamano
f2f5449379 Merge branch 'jc/comment-cygwin-win32api-in-makefile' into maint
* jc/comment-cygwin-win32api-in-makefile:
  Makefile: add comment on CYGWIN_V15_WIN32API
2013-01-14 07:34:37 -08:00
Junio C Hamano
f0c103b49c Merge branch 'rs/leave-base-name-in-name-field-of-tar' into maint
A tar archive created by "git archive" recorded a directory in a
way that made NetBSD's implementation of "tar" sometimes unhappy.

* rs/leave-base-name-in-name-field-of-tar:
  archive-tar: split long paths more carefully
2013-01-14 07:34:12 -08:00
Junio C Hamano
32e820bdc5 Merge branch 'jl/interrupt-clone-remove-separate-git-dir' into maint
When "git clone --separate-git-dir=$over_there" is interrupted, it
failed to remove the real location of the $GIT_DIR it created.  This
was most visible when interrupting a submodule update.

* jl/interrupt-clone-remove-separate-git-dir:
  clone: support atomic operation with --separate-git-dir
2013-01-14 07:33:49 -08:00
Junio C Hamano
bc60f9f377 Merge branch 'jc/maint-fmt-merge-msg-no-edit-lose-credit' into maint
"git merge --no-edit" computed who were involved in the work done
on the side branch, even though that information is to be discarded
without getting seen in the editor.

* jc/maint-fmt-merge-msg-no-edit-lose-credit:
  merge --no-edit: do not credit people involved in the side branch
2013-01-14 07:33:30 -08:00
Junio C Hamano
7842c44ccb Merge branch 'jc/apply-trailing-blank-removal' into maint
"git apply" misbehaved when fixing whitespace breakages by removing
excess trailing blank lines.

* jc/apply-trailing-blank-removal:
  apply.c:update_pre_post_images(): the preimage can be truncated
2013-01-14 07:33:08 -08:00
Junio C Hamano
659742f796 Merge branch 'pf/editor-ignore-sigint' into maint
The behaviour visible to the end users was confusing, when they
attempt to kill a process spawned in the editor that was in turn
launched by Git with SIGINT (or SIGQUIT), as Git would catch that
signal and die.  We ignore these signals now.

* pf/editor-ignore-sigint:
  fix compilation with NO_PTHREADS
  launch_editor: propagate signals from editor to git
  run-command: do not warn about child death from terminal
  launch_editor: ignore terminal signals while editor has control
  launch_editor: refactor to use start/finish_command
  run-command: drop silent_exec_failure arg from wait_or_whine
2013-01-14 07:32:25 -08:00
Junio C Hamano
6cf0a9e9fc Merge branch 'mk/maint-graph-infinity-loop' into maint
* mk/maint-graph-infinity-loop:
  graph.c: infinite loop in git whatchanged --graph -m
2013-01-14 07:32:18 -08:00
Junio C Hamano
ab60f2ce2d Merge branch 'as/api-allocation-doc' into maint
* as/api-allocation-doc:
  api-allocation-growing.txt: encourage better variable naming
2013-01-11 16:51:01 -08:00
Junio C Hamano
d0f945622b Merge branch 'jk/enable-test-lint-by-default' into maint
We have two simple and quick tests to catch common mistakes when
writing test scripts, but we did not run them by default when
running tests.

* jk/enable-test-lint-by-default:
  tests: turn on test-lint by default
2013-01-11 16:49:38 -08:00
Junio C Hamano
b663af57c3 Merge branch 'ap/merge-stop-at-prepare-commit-msg-failure' into maint
"git merge" started calling prepare-commit-msg hook like "git
commit" does some time ago, but forgot to pay attention to the exit
status of the hook.

* ap/merge-stop-at-prepare-commit-msg-failure:
  merge: Honor prepare-commit-msg return code
2013-01-11 16:49:01 -08:00
Junio C Hamano
02cb8da20d Merge branch 'jc/submittingpatches' into maint
* jc/submittingpatches:
  SubmittingPatches: give list and maintainer addresses
  SubmittingPatches: remove overlong checklist
  SubmittingPatches: mention subsystems with dedicated repositories
  SubmittingPatches: who am I and who cares?
2013-01-11 16:48:54 -08:00
Junio C Hamano
23ad617702 Merge branch 'os/gitweb-highlight-uncaptured' into maint
"gitweb", when sorting by age to show repositories with new
activities first, used to sort repositories with absolutely nothing
in it early, which was not very useful.

* os/gitweb-highlight-uncaptured:
  gitweb: fix error in sanitize when highlight is enabled
2013-01-11 16:48:30 -08:00
Junio C Hamano
378e5e4d9f Merge branch 'jn/less-reconfigure' into maint
When autoconf is used, any build on a different commit always ran
"config.status --recheck" even when unnecessary.

* jn/less-reconfigure:
  build: do not automatically reconfigure unless configure.ac changed
2013-01-11 16:48:03 -08:00
Junio C Hamano
37a11306d5 Merge branch 'kb/maint-bundle-doc' into maint
* kb/maint-bundle-doc:
  Documentation: full-ness of a bundle is significant for cloning
  Documentation: correct example restore from bundle
2013-01-11 16:47:56 -08:00
Junio C Hamano
b88cb88158 Merge branch 'as/test-name-alias-uniquely' into maint
* as/test-name-alias-uniquely:
  Use longer alias names in subdirectory tests
2013-01-11 16:47:34 -08:00
Junio C Hamano
e6f1550aa5 Merge branch 'jn/warn-on-inaccessible-loosen' into maint
When attempting to read the XDG-style $HOME/.config/git/config and
finding that $HOME/.config/git is a file, we gave a wrong error
message, instead of treating the case as "a custom config file does
not exist there" and moving on.

* jn/warn-on-inaccessible-loosen:
  config: exit on error accessing any config file
  doc: advertise GIT_CONFIG_NOSYSTEM
  config: treat user and xdg config permission problems as errors
  config, gitignore: failure to access with ENOTDIR is ok
2013-01-11 16:47:07 -08:00
Junio C Hamano
22fd1c8410 Merge branch 'ja/directory-attrs' into maint
The attribute mechanism didn't allow limiting attributes to be
applied to only a single directory itself with "path/" like the
exclude mechanism does.

* ja/directory-attrs:
  Add directory pattern matching to attributes
2013-01-11 16:46:46 -08:00
Junio C Hamano
c039f35b8a Merge branch 'jc/fetch-ignore-symref' into maint
"git fetch --mirror" and fetch that uses other forms of refspec with
wildcard used to attempt to update a symbolic ref that match the
wildcard on the receiving end, which made little sense (the real ref
that is pointed at by the symbolic ref would be updated anyway).

Symbolic refs no longer are affected by such a fetch.

* jc/fetch-ignore-symref:
  fetch: ignore wildcarded refspecs that update local symbolic refs
2013-01-11 16:45:44 -08:00
Junio C Hamano
9a4a941e04 Merge branch 'ss/svn-prompt' into maint
The way "git svn" asked for password using SSH_ASKPASS and
GIT_ASKPASS was not in line with the rest of the system.

* ss/svn-prompt:
  git-svn, perl/Git.pm: extend and use Git->prompt method for querying users
  perl/Git.pm: Honor SSH_ASKPASS as fallback if GIT_ASKPASS is not set
  git-svn, perl/Git.pm: add central method for prompting passwords
2013-01-11 16:45:06 -08:00
Dylan Smith
ca87dd623d git-completion.bash: silence "not a valid object" errors
Trying to complete the command

  git show master:./file

would cause a "Not a valid object name" error to be output on standard
error. Silence the error so it won't appear on the command line.

Signed-off-by: Dylan Smith <dylan.ah.smith@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-11 08:44:08 -08:00
Nguyễn Thái Ngọc Duy
95b63f1ebb clone: forbid --bare --separate-git-dir <dir>
The --separate-git-dir option was introduced to make it simple to put
the git directory somewhere outside the worktree, for example when
cloning a repository for use as a submodule.

It was not intended for use when creating a bare repository. In that
case there is no worktree and it is more natural to directly clone the
repository and create a .git file as separate steps:

        git clone --bare /path/to/repo.git bar.git
        printf 'gitdir: bar.git\n' >foo.git

Forbid the combination, making the command easier to explain.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-10 19:13:17 -08:00
Jonathan Nieder
9a6dcb37bd contrib/vim: simplify instructions for old vim support
Rely on the upstream filetype.vim instead of duplicating its rules in
git's instructions for syntax highlighting support on pre-7.2 vim
versions.

The result is a shorter contrib/vim/README.  More importantly, it lets
us punt on maintenance of the autocmd rules.

So now when we fix the upstream gitsendemail rule in light of commit
eed6ca7, new git users stuck on old vim reading contrib/vim/README can
automagically get the fix without any further changes needed to git.

Once the world has moved on to vim 7.2+ completely, we can get rid of
these instructions, but for now if they are this simple it's
effortless to keep them.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-10 14:58:54 -08:00
Junio C Hamano
bf7c3f749d Prepare for 1.8.1.1 2013-01-10 14:17:13 -08:00
Christian Couder
022250adfd Makefile: detect when PYTHON_PATH changes
When make is run, the python scripts are created from *.py files that
are changed to use the python given by PYTHON_PATH. And PYTHON_PATH
is set by default to /usr/bin/python on Linux.

However, next time make is run with a different value in PYTHON_PATH,
we failed to regenerate these scripts.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-10 14:14:37 -08:00
Junio C Hamano
f6f3921db6 Merge branch 'ta/remove-stale-translated-tut' into maint
* ta/remove-stale-translated-tut:
  Remove Documentation/pt_BR/gittutorial.txt
2013-01-10 14:11:18 -08:00
Junio C Hamano
3a0ee3eb2e Merge branch 'tb/test-t9810-no-sed-i' into maint
* tb/test-t9810-no-sed-i:
  t9810: Do not use sed -i
2013-01-10 14:10:40 -08:00
Junio C Hamano
1493bcc775 Merge branch 'tb/test-t9020-no-which' into maint
* tb/test-t9020-no-which:
  t9020: which is not portable
2013-01-10 14:10:36 -08:00
Junio C Hamano
3129891bbc Merge branch 'mh/pthreads-autoconf' into maint
* mh/pthreads-autoconf:
  configure.ac: fix pthreads detection on Mac OS X
2013-01-10 14:04:26 -08:00
Junio C Hamano
80ff618049 Merge branch 'jc/same-encoding' into maint
* jc/same-encoding:
  format_commit_message(): simplify calls to logmsg_reencode()
2013-01-10 14:04:24 -08:00
Junio C Hamano
74474a94f2 Merge branch 'sp/shortlog-missing-lf' into maint
* sp/shortlog-missing-lf:
  strbuf_add_wrapped*(): Remove unused return value
  shortlog: fix wrapping lines of wraplen
2013-01-10 14:04:23 -08:00
Junio C Hamano
2601298f43 Merge branch 'md/gitweb-sort-by-age' into maint
* md/gitweb-sort-by-age:
  gitweb: Sort projects with undefined ages last
2013-01-10 14:04:21 -08:00
Junio C Hamano
c12a978a35 Merge branch 'nd/invalidate-i-t-a-cache-tree' into maint
* nd/invalidate-i-t-a-cache-tree:
  cache-tree: invalidate i-t-a paths after generating trees
  cache-tree: fix writing cache-tree when CE_REMOVE is present
  cache-tree: replace "for" loops in update_one with "while" loops
  cache-tree: remove dead i-t-a code in verify_cache()
2013-01-10 14:04:19 -08:00
Junio C Hamano
f70eec8400 Merge branch 'jk/repack-ref-racefix' into maint
* jk/repack-ref-racefix:
  refs: do not use cached refs in repack_without_ref
2013-01-10 14:04:17 -08:00
Junio C Hamano
8bc714b408 Merge branch 'rb/http-cert-cred-no-username-prompt' into maint
* rb/http-cert-cred-no-username-prompt:
  http.c: Avoid username prompt for certifcate credentials
2013-01-10 14:03:54 -08:00
Peter Eisentraut
be33414b18 git-commit-tree(1): correct description of defaults
The old phrasing indicated that the EMAIL environment variable takes
precedence over the user.email configuration setting, but it is the
other way around.

Signed-off-by: Peter Eisentraut <peter@eisentraut.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-10 10:18:51 -08:00
John Keeping
29b1b21f07 git-fast-import(1): reorganise options
The options in git-fast-import(1) are not currently arranged in a
logical order, which has caused the '--done' options to be documented
twice (commit 3266de10).

Rearrange them into logical groups under subheadings.

Suggested-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-09 14:16:06 -08:00
John Keeping
c8a9f3d385 git-fast-import(1): combine documentation of --[no-]relative-marks
The descriptions of '--relative-marks' and '--no-relative-marks' make
more sense when read together instead of as two independent options.
Combine them into a single description block.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-09 14:10:53 -08:00
John Keeping
0e82bd0430 git-shortlog(1): document behaviour of zero-width wrap
Commit 00d3947 (Teach --wrap to only indent without wrapping) added
special behaviour for a width of zero in the '-w' argument to
'git-shortlog' but this was not documented.  Fix this.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-09 14:08:59 -08:00
John Keeping
850bc56def git-fast-import(1): remove duplicate '--done' option
The '--done' option to git-fast-import is documented twice in its manual
page.  Combine the best bits of each description, keeping the location
of the instance that was added first.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-08 13:20:45 -08:00