1
0
mirror of https://github.com/git/git.git synced 2024-10-20 20:28:13 +02:00
Commit Graph

25510 Commits

Author SHA1 Message Date
Johannes Sixt
650af7ae8b t3703: Skip tests using directory name ":" on Windows
":" is not allowed in file names on Windows. Detect this case and skip a
test if necessary.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-12 22:32:24 -07:00
Junio C Hamano
8f2d4b1934 Merge branch 'jc/maint-1.7.4-pathspec-stdin-and-cmdline'
Update the fix for 1.7.5 maintenance track.

* jc/maint-1.7.4-pathspec-stdin-and-cmdline:
  setup_revisions(): take pathspec from command line and --stdin correctly
2011-05-11 16:09:25 -07:00
Junio C Hamano
1b6d0ae588 Merge branch 'jc/maint-1.6.6-pathspec-stdin-and-cmdline'
Update the fix for 1.7.4 maintenance track.

* jc/maint-1.6.6-pathspec-stdin-and-cmdline:
  setup_revisions(): take pathspec from command line and --stdin correctly
2011-05-11 16:07:14 -07:00
Junio C Hamano
93e7d672fc revision.c: leave a note for "a lone :" enhancement
If we later add a command in the log family that by default limit
its operation to the current subdirectory, we would need to resurrect
the "a lone ':' on the command line means no pathspec whatsoever".

Now the codepath was cleaned up, we can do so in one place.  Leave a
note to mark where it is for later generations.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-11 15:23:25 -07:00
Junio C Hamano
25197ebe7f Merge branch 'jc/maint-1.6.6-pathspec-stdin-and-cmdline'
* jc/maint-1.6.6-pathspec-stdin-and-cmdline:
  setup_revisions(): take pathspec from command line and --stdin correctly
2011-05-11 15:14:13 -07:00
Junio C Hamano
2d83abd4b2 Merge branch 'jc/maint-1.6.6-pathspec-stdin-and-cmdline'
Update the fix for 1.7.4 maintenance track.

* jc/maint-1.6.6-pathspec-stdin-and-cmdline:
  setup_revisions(): take pathspec from command line and --stdin correctly
2011-05-11 14:57:45 -07:00
Junio C Hamano
4da5af3151 setup_revisions(): take pathspec from command line and --stdin correctly
When the command line has "--" disambiguator, we take the remainder of
argv[] as "prune_data", but when --stdin is given at the same time,
we need to append to the existing prune_data and end up attempting to
realloc(3) it.  That would not work.

Fix it by consistently using append_prune_data() throughout the input
processing.  Also avoid counting the number of existing paths in the
function over and over again.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-11 14:43:56 -07:00
Junio C Hamano
dbe9c5adf9 Update draft release notes to 1.7.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-11 11:56:11 -07:00
Junio C Hamano
a5794988dd Merge branch 'jn/gitweb-dependency'
* jn/gitweb-dependency:
  Remove gitweb/gitweb.cgi and other legacy targets from main Makefile
  git-instaweb: Simplify build dependency on gitweb
2011-05-11 11:38:39 -07:00
Junio C Hamano
c7fe5b61e1 Merge branch 'jc/maint-branch-mergeoptions'
* jc/maint-branch-mergeoptions:
  merge: make branch.<name>.mergeoptions correctly override merge.<option>

Conflicts:
	builtin/merge.c
2011-05-11 11:38:36 -07:00
Junio C Hamano
bd9a268845 Merge branch 'jn/maint-test-merge-verify-parents'
* jn/maint-test-merge-verify-parents:
  tests: teach verify_parents to check for extra parents
  tests: eliminate unnecessary setup test assertions
2011-05-11 11:38:10 -07:00
Junio C Hamano
0c529e44d3 Merge branch 'vh/config-interactive-singlekey-doc'
* vh/config-interactive-singlekey-doc:
  git-reset.txt: better docs for '--patch'
  git-checkout.txt: better docs for '--patch'
  git-stash.txt: better docs for '--patch'
  git-add.txt: document 'interactive.singlekey'
  config.txt: 'interactive.singlekey; is used by...
2011-05-11 11:38:06 -07:00
Junio C Hamano
f3b173daf4 Merge branch 'jc/maint-add-p-overlapping-hunks'
* jc/maint-add-p-overlapping-hunks:
  t3701: add-p-fix makes the last test to pass
  "add -p": work-around an old laziness that does not coalesce hunks
  add--interactive.perl: factor out repeated --recount option
  t3701: Editing a split hunk in an "add -p" session
  add -p: 'q' should really quit
2011-05-11 11:37:46 -07:00
Junio C Hamano
9cd805de61 Merge branch 'sr/maint-fast-import-tighten-option-parsing'
* sr/maint-fast-import-tighten-option-parsing:
  fast-import: fix option parser for no-arg options
2011-05-11 11:37:41 -07:00
Junio C Hamano
1f0f5b54ba Merge branch 'dm/http-cleanup'
* dm/http-cleanup:
  t5541-http-push: add test for chunked
  http-push: refactor curl_easy_setup madness
  http-push: use const for strings in signatures
  http: make curl callbacks match contracts from curl header
2011-05-11 11:37:38 -07:00
Junio C Hamano
ebfd72c856 Merge branch 'jn/ctags'
* jn/ctags:
  gitweb: Mark matched 'ctag' / contents tag (?by_tag=foo)
  gitweb: Change the way "content tags" ('ctags') are handled
  gitweb: Restructure projects list generation
2011-05-11 11:37:32 -07:00
Boris Faure
8b1ae678a3 Do not strip empty lines / trailing spaces from a commit message template
Templates should be just that: A form that the user fills out, and forms
have blanks. If people are attached to not having extra whitespace in the
editor, they can simply clean up their templates.

Added test with editor adding even more whitespace.

Signed-off-by: Boris Faure <billiob@gmail.com>
Based-on-patch-by:Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-11 11:20:28 -07:00
Junio C Hamano
2df7683b6e Merge branch 'fc/completion-zsh' into sg/completion-updates
* fc/completion-zsh:
  git-completion: fix regression in zsh support
2011-05-10 13:14:58 -07:00
Junio C Hamano
1a0c9a305f Revert "completion: don't declare 'local words' to make zsh happy"
This reverts commit 3bee6a4733a1ff03b9cc659ea026c6dc17567d4d, as the fix
that will be used by upstream zsh folks should make it unnecessary.
2011-05-10 13:13:50 -07:00
Felipe Contreras
52fd972d59 git-completion: fix regression in zsh support
The zsh support of git-completion script in contrib/ is broken for current
versions of zsh, and does not notice when there's a subcommand.

For example: "git log origi<TAB>" gives no completions because it would
try to find a "git origi..." command. This will be fixed by zsh 4.3.12,
but for now we can workaround it by backporting the same fix as zsh folks
implemented.

The problem started after commit v1.7.4-rc0~11^2~2 (bash: get
--pretty=m<tab> completion to work with bash v4), which introduced
_get_comp_words_by_ref() that comes from bash-completion[1] scripts, and
relies on the 'words' variable.

However, it turns out 'words' is a special variable used by zsh
completion. From zshcompwid(1):

  [...] the parameters are reset on each function exit (including nested
  function calls from within the completion widget) to the values they had
  when the function was entered.

As a result, subcommand words are lost.  Ouch.

This is now fixed in the latest master branch of zsh[2] by simply defining
'words' as hidden (typeset -h), which removes the special meaning inside
the emulated bash function. So let's do the same.

Jonathan Nieder helped on the commit message.

  [1] http://bash-completion.alioth.debian.org/
  [2] http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=commitdiff;h=e880604f029088f32fb1ecc39213d720ae526aaa

Reported-by: Stefan Haller <lists@haller-berlin.de>
Comments-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-10 13:08:51 -07:00
Conrad Irwin
02a481fc6a Test atomic git-commit --interactive
Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-10 13:04:00 -07:00
Nguyễn Thái Ngọc Duy
6fd09f537c t3703, t4208: add test cases for magic pathspec
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-10 12:42:59 -07:00
Junio C Hamano
0e539dca51 rev/path disambiguation: further restrict "misspelled index entry" diag
A colon followed by anything !isalnum() (e.g. ":/heh") at this point is
known not to be an existing rev.  Just give a generic "neither a rev nor
a path" error message.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-10 12:38:06 -07:00
Junio C Hamano
2e83b66c32 fix overslow :/no-such-string-ever-existed diagnostics
"git cmd :/no-such-string-ever-existed" runs an extra round of get_sha1()
since 009fee4 (Detailed diagnosis when parsing an object name fails.,
2009-12-07).  Once without error diagnosis to see there is no commit with
such a string in the log message (hence "it cannot be a ref"), and after
seeing that :/no-such-string-ever-existed is not a filename (hence "it
cannot be a path, either"), another time to give "better diagnosis".

The thing is, the second time it runs, we already know that traversing the
history all the way down to the root will _not_ find any matching commit.

Rename misguided "gently" parameter, which is turned off _only_ when the
"detailed diagnosis" codepath knows that it cannot be a ref and making the
call only for the caller to die with a message.  Flip its meaning (and
adjust the callers) and call it "only_to_die", which is not a great name,
but it describes far more clearly what the codepaths that switches their
behaviour based on this variable do.

On my box, the command spends ~1.8 seconds without the patch to make the
report; with the patch it spends ~1.12 seconds.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-10 12:37:54 -07:00
Junio C Hamano
9619617d33 fix overstrict :<path> diagnosis
Given "git log :", we get a disambiguation message that tries to be
helpful and yet totally misses the point, i.e.

    $ git log :
    fatal: Path '' does not exist (neither on disk nor in the index).
    $ git log :/
    fatal: Path '/' exists on disk, but not in the index.

An empty path nor anything that begins with '/' cannot possibly in the
index, and it is wrong to guess that the user might have meant to access
such an index entry.

It should yield the same error message as "git log '*.c'", i.e.

    $ git log '*.c'
    fatal: ambiguous argument '*.c': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-10 12:36:06 -07:00
Junio C Hamano
7c5f3cc4a5 grep: use get_pathspec() correctly
When there is no remaining string in argv, get_pathspec(prefix, argv)
will return a two-element array that has prefix as the first element,
so there is no need to re-roll that logic in the code that uses
get_pathspec().

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-10 12:11:01 -07:00
Junio C Hamano
b060ce7de4 pathspec: drop "lone : means no pathspec" from get_pathspec()
We may want to give the pathspec subsystem such a feature, but not while
we are still using get_pathspec() that returns a stupid "char **" that
loses subtle nuances that existed in the input string.

In the meantime, the callers of get_pathspec() that want to support it
could do an equivalent before feeding their argv[] to the function
themselves quite easily.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-10 12:07:12 -07:00
Junio C Hamano
6d94292710 Revert "magic pathspec: add ":(icase)path" to match case insensitively"
This reverts commit d0546e2d488b1ba185c430b638619ab1d91af509, which
was only meant to be a Proof-of-concept used during the discussion.

The real implementation of the feature needs to wait until we migrate
all the code to use "struct pathspec", not "char **", to represent
richer semantics given to pathspec.
2011-05-10 10:23:41 -07:00
Nguyễn Thái Ngọc Duy
28911091c1 sparse checkout: do not eagerly decide the fate for whole directory
Sparse-setting code follows closely how files are excluded in
read_directory(), every entry (including directories) are fed to
excluded_from_list() to decide if the entry is suitable. Directories
are treated no different than files. If a directory is matched (or
not), the whole directory is considered matched (or not) and the
process moves on.

This generally works as long as there are no patterns to exclude parts
of the directory. In case of sparse checkout code, the following patterns

  t
  !t/t0000-basic.sh

will produce a worktree with full directory "t" even if t0000-basic.sh
is requested to stay out.

By the same reasoning, if a directory is to be excluded, any rules to
re-include certain files within that directory will be ignored.

Fix it by always checking files against patterns. If no pattern can be
used to decide whether an entry is in our out
(ie. excluded_from_list() returns -1), the entry will be
included/excluded the same as their parent directory.

Noticed-by: <skillzero@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-10 09:04:26 -07:00
Nguyễn Thái Ngọc Duy
d61ebbe8f5 t1011: fix sparse-checkout initialization and add new file
Do not append to $GIT_DIR/info/sparse-checkout at each test, overwrite
it instead.

Also add sub/addedtoo for more complex tests later on

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-10 09:03:13 -07:00
Michael Schubert
4f0accd638 tag: disallow '-' as tag name
Disallow '-' as tag name, as well as tag names starting with '-', as it
would be cumbersome to "git checkout tags/-" because "git checkout -" is
to switch to the previous branch.

Add strbuf_check_tag_ref() as helper to check a refname for a tag.

Signed-off-by: Michael Schubert <mschub@elegosoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-10 08:45:37 -07:00
Conrad Irwin
e6b57a8a4e Add commit to list of config.singlekey commands
Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 17:02:33 -07:00
Conrad Irwin
b4bd466820 Add support for -p/--patch to git-commit
The --interactive flag is already shared by git add and git commit,
share the -p and --patch flags too.

Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 17:02:33 -07:00
Conrad Irwin
e41fcfe955 Allow git commit --interactive with paths
Make git commit --interactive feel more like git add --interactive by
allowing the user to restrict the list of files they have to deal with.

A test in t7501 used to ensure that this is not allowed; no need for that
anymore.

Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 17:02:33 -07:00
Jeff King
587ac8c9d4 t7501.8: feed a meaningful command
The command expects "git commit --interactive <path>" to fail because you
cannot (yet) limit "commit --interactive" with a pathspec, but even if the
command allowed to take <path>, the test would have failed as saying just
7:quit would leave the index the same as the current commit, leading to an
attempt to create an empty commit that would fail without --allow-empty.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 17:02:08 -07:00
Luke Diamand
ecdba36da6 git-p4: small improvements to user-preservation
. Slightly more paranoid checking of results from 'p4 change'
. Remove superfluous "-G"
. Don't modify the username if it is unchanged.
. Add a comment in the change template to show what is
  going to be done.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-By: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 16:26:51 -07:00
Jeff King
ed747dd521 blame: add --line-porcelain output format
This is just like --porcelain, except that we always output
the commit information for each line, not just the first
time it is referenced. This can make quick and dirty scripts
much easier to write; see the example added to the blame
documentation.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 15:27:50 -07:00
Jeff King
e86226e340 blame: refactor porcelain output
This is in preparation for adding more porcelain output
options. The three changes are:

  1. emit_porcelain now receives the format option flags

  2. emit_one_suspect_detail takes an optional "repeat"
     parameter to suppress the "show only once" behavior

  3. The code for emitting porcelain suspect is factored
     into its own function for repeatability.

There should be no functional changes.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 15:27:32 -07:00
Jeff King
838466b8f7 add tests for various blame formats
We don't seem to have any tests for "blame --porcelain".
Let's at least do a trivial test on a simple example.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 15:26:27 -07:00
Johannes Sixt
9fb1e69842 Honor $(prefix) set in config.mak* when defining ETC_GIT*
Notice that the prefix specified for the build influenced the definitions
of ETC_GITCONFIG and ETC_GITATTRIBUTES only when it was exactly '/usr'.
Kacper Kornet noticed that this was furthermore only the case when the
build was triggered using 'make prefix=/usr', i.e., the prefix was given
on the command line; it did not work when the prefix was specified in
config.mak because this file is included much later in the Makefile.

To fix this, move the conditional after the inclusion of config.mak.

Additionally, it is desirable to specify the etc directory for a build
(for example, a build with prefix /usr/local may still want to have the
system configuration in /etc/gitconfig). For this purpose, promote the
variable 'sysconfdir' from a helper variable to a configuration
variable. The prefix check that was moved must now be wrapped so that it
does not override sysconfdir setting given in config.mak.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 15:13:03 -07:00
Junio C Hamano
410ee20bde Revert "Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir"
This reverts commit 2910bf56a4ffc13c398fb04ba32910cb3b724091, as it
does not really solve the issue of making $(sysconfigdir) any more
useful than it currently is.
2011-05-09 15:12:13 -07:00
Junio C Hamano
3bfba20dae convert: make it harder to screw up adding a conversion attribute
The current internal API requires the callers of setup_convert_check() to
supply the git_attr_check structures (hence they need to know how many to
allocate), but they grab the same set of attributes for given path.

Define a new convert_attrs() API that fills a higher level information that
the callers (convert_to_git and convert_to_working_tree) really want, and
move the common code to interact with the attributes system to it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 14:59:09 -07:00
Junio C Hamano
83295964b3 convert: make it safer to add conversion attributes
The places that need to pass an array of "struct git_attr_check" needed to
be careful to pass a large enough array and know what index each element
lied.  Make it safer and easier to code these.

Besides, the hard-coded sequence of initializing various attributes was
too ugly after we gained more than a few attributes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 14:59:09 -07:00
Junio C Hamano
c61dcff9d6 convert: give saner names to crlf/eol variables, types and functions
Back when the conversion was only about the end-of-line convention, it
might have made sense to call what we do upon seeing CR/LF simply an
"action", but these days the conversion routines do a lot more than just
tweaking the line ending.  Raname "action" to "crlf_action".

The function that decides what end of line conversion to use on the output
codepath was called "determine_output_conversion", as if there is no other
kind of output conversion.  Rename it to "output_eol"; it is a function
that returns what EOL convention is to be used.

A function that decides what "crlf_action" needs to be used on the input
codepath, given what conversion attribute is set to the path and global
end-of-line convention, was called "determine_action".  Rename it to
"input_crlf_action".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 14:59:09 -07:00
Junio C Hamano
ec70f52f6f convert: rename the "eol" global variable to "core_eol"
Yes, it is clear that "eol" wants to mean some sort of end-of-line thing,
but as the name of a global variable, it is way too short to describe what
kind of end-of-line thing it wants to represent. Besides, there are many
codepaths that want to use their own local "char *eol" variable to point
at the end of the current line they are processing.

This global variable holds what we read from core.eol configuration
variable. Name it as such.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 14:58:52 -07:00
Junio C Hamano
365c2aaafc t1507: avoid "${parameter<op>'word'}" inside double-quotes
Kacper Kornet noticed that a $variable in "word" in the above construct is
not substituted by his pdksh.  Modern POSIX compliant shells (e.g. dash,
ksh, bash) all seem to interpret POSIX "2.6.2 Parameter Expansion" that
says "word shall be subjected to tilde expansion, parameter expansion,
command substitution, and arithmetic expansion" in ${parameter<op>word},
to mean that the word is expanded as if it appeared in dq pairs, so if the
word were "'$variable'" (sans dq) it would expand to a single quote, the
value of the $variable and then a single quote.

Johannes Sixt reports that the behavior of quoting at the right of :- when
the ${...:-...} expansion appears in double-quotes was debated recently at
length at the Austin group.  We can avoid this issue and future-proof the
test by a slight rewrite.

Helped-by: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 09:19:42 -07:00
Jonathan Nieder
dad4277529 completion: move private shopt shim for zsh to __git_ namespace
Most zsh users probably probably do not expect a custom shopt function
to enter their environment just because they ran "source
~/.git-completion.sh".

Such namespace pollution makes development of other scripts confusing
(because it makes the bash-specific shopt utility seem to be available
in zsh) and makes git's tab completion script brittle (since any other
shell snippet implementing some other subset of shopt will break it).
Rename the shopt shim to the more innocuous __git_shopt to be a good
citizen (with two underscores to avoid confusion with completion rules
for a hypothetical "git shopt" command).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-08 21:08:13 -07:00
Junio C Hamano
0bf9fc0cd2 t3701: add-p-fix makes the last test to pass
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-08 13:43:04 -07:00
Junio C Hamano
0f891e7d7e rerere: libify rerere_clear() and rerere_gc()
This moves the two features from builtin/rerere.c to a more library-ish
portion of the codebase.  No behaviour change.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-08 12:55:34 -07:00
Conrad Irwin
1020d08786 Use a temporary index for git commit --interactive
Change the behaviour of git commit --interactive so that when you abort
the commit (by leaving the commit message empty) the index remains
unchanged.

Hitherto an aborted commit --interactive has added the selected hunks to
the index regardless of whether the commit succeeded or not.

Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-08 12:28:30 -07:00