Commit Graph

24697 Commits

Author SHA1 Message Date
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 d0546e2d48, 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
Junio C Hamano
d0546e2d48 magic pathspec: add ":(icase)path" to match case insensitively
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-08 16:20:16 -07:00
Junio C Hamano
2f6c9760de magic pathspec: futureproof shorthand form
The earlier design was to take whatever non-alnum that the short format
parser happens to support, leaving the rest as part of the pattern, so a
version of git that knows '*' magic and a version that does not would have
behaved differently when given ":*Makefile".  The former would have
applied the '*' magic to the pattern "Makefile", while the latter would
used no magic to the pattern "*Makefile".

Instead, just reserve all non-alnum ASCII letters that are neither glob
nor regexp special as potential magic signature, and when we see a magic
that is not supported, die with an error message, just like the longhand
codepath does.

With this, ":%#!*Makefile" will always mean "%#!" magic applied to the
pattern "*Makefile", no matter what version of git is used (it is a
different matter if the version of git supports all of these three magic
matching rules).

Also make ':' without anything else to mean "there is no pathspec".  This
would allow differences between "git log" and "git log ." run from the top
level of the working tree (the latter simplifies no-op commits away from
the history) to be expressed from a subdirectory by saying "git log :".

Helped-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-08 16:19:48 -07:00
Junio C Hamano
8a42c98501 magic pathspec: add tentative ":/path/from/top/level" pathspec support
Support ":/" magic string that can be prefixed to a pathspec element to
say "this names the path from the top-level of the working tree", when
you are in the subdirectory.

For example, you should be able to say:

    $ edit Makefile ;# top-level
    $ cd Documentation
    $ edit git.txt ;# in the subdirectory

and then do one of three things, still inside the subdirectory:

    $ git add -u .  ;# add only Documentation/git.txt
    $ git add -u :/ ;# add everything, including paths outside Documentation
    $ git add -u    ;# whatever the default setting is.

To truly support magic pathspec, the API needs to be restructured so that
get_pathspec() and init_pathspec() are unified into one call.  Currently,
the former just prefixes the user supplied pathspec with the current
subdirectory path, and the latter takes the output from the former and
pre-parses them into a bit richer structure for easier handling.  They
should become a single API function that takes the current subdirectory
path and the remainder of argv[] (after parsing --options and revision
arguments from the command line) and returns an array of parsed pathspec
elements, and "magic" should become attributes of struct pathspec_item.

This patch implements only "top" magic because it can be hacked into the
system without such a refactoring.

The syntax for magic pathspec prefix is designed to be extensible yet
simple to type to invoke a simple magic like "from the top".  The parser
for the magic prefix is hooked into get_pathspec() function in this patch,
and it needs to be moved when we refactor the API.

But we have to start from somewhere.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-06 17:08:46 -07:00
Junio C Hamano
a91df69cbb Merge branch 'mm/maint-log-n-with-diff-filtering'
* mm/maint-log-n-with-diff-filtering:
  log: fix --max-count when used together with -S or -G
2011-03-19 23:25:38 -07:00
Junio C Hamano
06a054014b Merge branch 'mg/rev-list-n-reverse-doc'
* mg/rev-list-n-reverse-doc:
  git-log.txt,rev-list-options.txt: put option blocks in proper order
  git-log.txt,rev-list-options.txt: -n/--max-count is commit limiting
2011-03-19 23:25:32 -07:00
Junio C Hamano
bcd5461a35 Merge branch 'js/rerere-forget-always-take-pathspec'
* js/rerere-forget-always-take-pathspec:
  rerere forget: deprecate invocation without pathspec
2011-03-19 23:24:48 -07:00
Junio C Hamano
1e239079f7 Merge branch 'ab/i18n-basic'
* ab/i18n-basic:
  i18n: "make distclean" should clean up after "make pot"
  i18n: Makefile: "pot" target to extract messages marked for translation
  i18n: add stub Q_() wrapper for ngettext
  i18n: do not poison translations unless GIT_GETTEXT_POISON envvar is set
  i18n: add GETTEXT_POISON to simulate unfriendly translator
  i18n: add no-op _() and N_() wrappers
  commit, status: use status_printf{,_ln,_more} helpers
  commit: refer to commit template as s->fp
  wt-status: add helpers for printing wt-status lines

Conflicts:
	builtin/commit.c
2011-03-19 23:24:42 -07:00
Junio C Hamano
32b31ab7f3 Merge branch 'uk/ls-remote-in-get-remote-url'
* uk/ls-remote-in-get-remote-url:
  git-request-pull: open-code the only invocation of get_remote_url
  get_remote_url(): use the same data source as ls-remote to get remote urls
2011-03-19 23:24:34 -07:00
Junio C Hamano
9d59e6607a Merge branch 'ss/mergetool--lib'
* ss/mergetool--lib:
  mergetool--lib: Add Beyond Compare 3 as a tool
  mergetool--lib: Sort tools alphabetically for easier lookup
2011-03-19 23:24:27 -07:00
Junio C Hamano
f4784b3eab Merge branch 'jn/status-translatable'
* jn/status-translatable:
  commit, status: use status_printf{,_ln,_more} helpers
  commit: refer to commit template as s->fp
  wt-status: add helpers for printing wt-status lines

Conflicts:
	builtin/commit.c
2011-03-19 23:24:19 -07:00
Junio C Hamano
0d7f242110 Merge branch 'jk/trace-sifter'
* jk/trace-sifter:
  trace: give repo_setup trace its own key
  add packet tracing debug code
  trace: add trace_strbuf
  trace: factor out "do we want to trace" logic
  trace: refactor to support multiple env variables
  trace: add trace_vprintf
2011-03-19 23:24:12 -07:00
Junio C Hamano
dc7f96f1f4 Merge branch 'jk/format-patch-multiline-header'
* jk/format-patch-multiline-header:
  format-patch: rfc2047-encode newlines in headers
  format-patch: wrap long header lines
  strbuf: add fixed-length version of add_wrapped_text
2011-03-19 23:24:08 -07:00
Junio C Hamano
0ce6a51b43 Merge branch 'jk/merge-rename-ux'
* jk/merge-rename-ux:
  pull: propagate --progress to merge
  merge: enable progress reporting for rename detection
  add inexact rename detection progress infrastructure
  commit: stop setting rename limit
  bump rename limit defaults (again)
  merge: improve inexact rename limit warning
2011-03-19 23:23:56 -07:00
Junio C Hamano
edf9d719d1 Merge branch 'maint'
* maint:
  gitweb: Always call parse_date with timezone parameter
  bisect: explain the rationale behind 125
2011-03-19 23:21:10 -07:00
René Scharfe
c41dd2fd7d grep: read patterns from stdin with -f -
Support the well-know convention of reading standard input instead of a
named file if "-" (dash) is specified.  GNU grep does the same.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-19 21:46:52 -07:00
Jakub Narebski
6368d9f1af gitweb: Always call parse_date with timezone parameter
Timezone is required to correctly set local time, which would be needed
for future 'localtime' feature.

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

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-19 21:46:32 -07:00
Junio C Hamano
958bf6b768 bisect: explain the rationale behind 125
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-19 21:46:24 -07:00
Junio C Hamano
af4c62ae88 Merge branch 'maint'
* maint:
  docs: fix grammar in gitattributes.txt
2011-03-18 16:20:49 -07:00
Alexei Sholik
b547ce0b18 docs: fix grammar in gitattributes.txt
[jc: with a fixlet from Marc Branchaud]

Signed-off-by: Alexei Sholik <alcosholik@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-18 09:58:47 -07:00
Carlos Martín Nieto
e2a57aac8a Name make_*_path functions more accurately
Rename the make_*_path functions so it's clearer what they do, in
particlar make clear what the differnce between make_absolute_path and
make_nonrelative_path is by renaming them real_path and absolute_path
respectively. make_relative_path has an understandable name and is
renamed to relative_path to maintain the name convention.

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

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-17 16:08:30 -07:00
Michael J Gruber
a3ca9b0fbe RelNotes/1.7.5.txt: typo and language fixes
Also remove entries for fixes that are already present in the
maintenance track.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 17:02:58 -07:00
Junio C Hamano
b2f6eab402 Merge branch 'maint'
* maint:
  Prepare draft release notes to 1.7.4.2
  gitweb: highlight: replace tabs with spaces
  make_absolute_path: return the input path if it points to our buffer
  valgrind: ignore SSE-based strlen invalid reads
  diff --submodule: split into bite-sized pieces
  cherry: split off function to print output lines
  branch: split off function that writes tracking info and commit subject
  standardize brace placement in struct definitions
  compat: make gcc bswap an inline function
  enums: omit trailing comma for portability

Conflicts:
	RelNotes
2011-03-16 16:59:30 -07:00
Junio C Hamano
fbcda3c0a7 Prepare draft release notes to 1.7.4.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 16:47:40 -07:00
Junio C Hamano
afb497d472 Merge branch 'jn/maint-commit-missing-template' into maint
* jn/maint-commit-missing-template:
  commit: error out for missing commit message template
2011-03-16 16:47:26 -07:00
Junio C Hamano
43c1b6efb8 Merge branch 'lt/rename-no-extra-copy-detection' into maint
* lt/rename-no-extra-copy-detection:
  diffcore-rename: improve estimate_similarity() heuristics
  diffcore-rename: properly honor the difference between -M and -C
  for_each_hash: allow passing a 'void *data' pointer to callback
2011-03-16 16:47:26 -07:00
Junio C Hamano
4e530c5049 Merge branch 'jk/diffstat-binary' into maint
* jk/diffstat-binary:
  diff: don't retrieve binary blobs for diffstat
  diff: handle diffstat of rewritten binary files
2011-03-16 16:47:26 -07:00
Junio C Hamano
13a39e2d86 Merge branch 'mg/maint-difftool-vim-readonly' into maint
* mg/maint-difftool-vim-readonly:
  mergetool-lib: call vim in readonly mode for diffs
2011-03-16 16:47:26 -07:00
Junio C Hamano
c9b7cc0473 Merge branch 'jn/test-terminal-punt-on-osx-breakage' into maint
* jn/test-terminal-punt-on-osx-breakage:
  tests: skip terminal output tests on OS X
2011-03-16 16:47:26 -07:00
Junio C Hamano
8209b7fb9b Merge branch 'jk/fail-null-clone' into maint
* jk/fail-null-clone:
  clone: die when trying to clone missing local path
2011-03-16 16:47:26 -07:00
Junio C Hamano
61a6f1faec Merge branch 'jh/push-default-upstream-configname' into maint
* jh/push-default-upstream-configname:
  push.default: Rename 'tracking' to 'upstream'
2011-03-16 16:47:26 -07:00
Junio C Hamano
7633a5ab9a Merge branch 'mg/placeholders-are-lowercase' into maint
* mg/placeholders-are-lowercase:
  Make <identifier> lowercase in Documentation
  Make <identifier> lowercase as per CodingGuidelines
  Make <identifier> lowercase as per CodingGuidelines
  Make <identifier> lowercase as per CodingGuidelines
  CodingGuidelines: downcase placeholders in usage messages
2011-03-16 16:47:25 -07:00
Junio C Hamano
bd2700dbdf Merge branch 'mg/patch-id' into maint
* mg/patch-id:
  git-patch-id: do not trip over "no newline" markers
  git-patch-id: test for "no newline" markers
2011-03-16 16:47:25 -07:00
Junio C Hamano
5b8aac32fb Merge branch 'js/maint-merge-use-prepare-commit-msg-hook' into maint
* js/maint-merge-use-prepare-commit-msg-hook:
  merge: honor prepare-commit-msg hook
2011-03-16 16:47:25 -07:00
Kevin Cernekee
6affdbe677 gitweb: highlight: replace tabs with spaces
Consider the following code fragment:

        /*
         * test
         */

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

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

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

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

vim list mode:

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

In gitweb, this winds up looking something like:

   1         /*
   2     * test
   3     */

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

The desired output is:

   1         /*
   2          * test
   3          */

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

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Acked-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 16:18:58 -07:00
Carlos Martín Nieto
1d679de58e make_absolute_path: return the input path if it points to our buffer
Some codepaths call make_absolute_path with its own return value as
input. In such a cases, return the path immediately.

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

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 13:51:22 -07:00
Carlos Martín Nieto
b406a2d3e3 valgrind: ignore SSE-based strlen invalid reads
Some versions of strlen use SSE to speed up the calculation and load 4
bytes at a time, even if it means reading past the end of the
allocated memory. This read is safe and when the strlen function is
inlined, it is not replaced by valgrind, which reports a
false-possitive.

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

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 13:19:56 -07:00
Jonathan Nieder
06316234ac vcs-svn: remove spurious semicolons
trp_gen is not a statement or function call, so it should not be
followed with a semicolon.  Noticed by gcc -pedantic.

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

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 12:56:23 -07:00
Jonathan Nieder
808a95dcad diff --submodule: split into bite-sized pieces
Introduce two functions:

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

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

   It returns nonzero on error.

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

The goal is just readability.  No functional change intended.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 12:55:49 -07:00
Jonathan Nieder
a3a32e7f08 cherry: split off function to print output lines
Readers uninterested in the details of "git cherry"'s output format
can see

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

and ignore the details.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 12:54:44 -07:00
Jonathan Nieder
6e0332ec3e branch: split off function that writes tracking info and commit subject
Introduce a add_verbose_info function that takes care of adding

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

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

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

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 12:52:15 -07:00
Jonathan Nieder
9cba13ca5d standardize brace placement in struct definitions
In a struct definitions, unlike functions, the prevailing style is for
the opening brace to go on the same line as the struct name, like so:

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

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

Linus sayeth:

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

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 12:49:02 -07:00
Jonathan Nieder
c6c8d0b797 compat: make gcc bswap an inline function
Without this change, gcc -pedantic warns:

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

An inline function is more readable anyway.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 12:44:59 -07:00
Jonathan Nieder
c9b6782a08 enums: omit trailing comma for portability
Since v1.7.2-rc0~23^2~2 (Add per-repository eol normalization,
2010-05-19), building with gcc -std=gnu89 -pedantic produces warnings
like the following:

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

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

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 12:31:32 -07:00
Junio C Hamano
276e017f2f Merge branch 'nd/struct-pathspec'
* nd/struct-pathspec:
  declare 1-bit bitfields to be unsigned
2011-03-16 00:17:05 -07:00
Jonathan Nieder
9ddf17268c declare 1-bit bitfields to be unsigned
As "gcc -pedantic" notices, a two's complement 1-bit signed integer
cannot represent the value '1'.

 dir.c: In function 'init_pathspec':
 dir.c:1291:4: warning: overflow in implicit constant conversion [-Woverflow]

In the spirit of v1.7.1-rc1~10 (2010-04-06), 'unsigned' is what was
intended, so let's make the flags unsigned.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-15 22:24:29 -07:00
Junio C Hamano
a62eafb0aa Update draft release notes to 1.7.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-15 15:17:54 -07:00
Junio C Hamano
d0ef5a7e42 Merge branch 'jk/strbuf-vaddf'
* jk/strbuf-vaddf:
  compat: fall back on __va_copy if available
  strbuf: add strbuf_vaddf
  compat: provide a fallback va_copy definition
2011-03-15 14:23:04 -07:00
Junio C Hamano
bde7f7389f Merge branch 'mm/push-default-advice'
* mm/push-default-advice:
  push: better error message when no remote configured
  push: better error messages when push.default = tracking
2011-03-15 14:22:55 -07:00