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
Junio C Hamano
2f312e8851 Git 1.7.5.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.7.5.1
2011-05-04 15:47:40 -07:00
Junio C Hamano
f5bf1b5f6b Merge branch 'jh/dirstat' into maint
* jh/dirstat:
  --dirstat: In case of renames, use target filename instead of source filename
  Teach --dirstat not to completely ignore rearranged lines within a file
  --dirstat-by-file: Make it faster and more correct
  --dirstat: Describe non-obvious differences relative to --stat or regular diff
2011-05-04 14:59:07 -07:00
Junio C Hamano
419272d87b Merge branch 'sp/maint-clear-postfields' into maint
* sp/maint-clear-postfields:
  http: clear POSTFIELDS when initializing a slot
2011-05-04 14:58:56 -07:00
Junio C Hamano
be44a20aa8 Merge branch 'jk/maint-stash-oob' into maint
* jk/maint-stash-oob:
  stash: fix false positive in the invalid ref test.
  stash: fix accidental apply of non-existent stashes

Conflicts:
	t/t3903-stash.sh
2011-05-04 14:58:42 -07:00
Junio C Hamano
476e42422d Merge branch 'jk/maint-upload-pack-shallow' into maint
* jk/maint-upload-pack-shallow:
  upload-pack: start pack-objects before async rev-list
2011-05-04 14:58:13 -07:00
Junio C Hamano
e9f1878da7 Merge branch 'dm/stash-k-i-p' into maint
* dm/stash-k-i-p:
  stash: ensure --no-keep-index and --patch can be used in any order
  stash: add two more tests for --no-keep-index
2011-05-04 14:57:49 -07:00
Junio C Hamano
f28d2e33c6 Merge branch 'jc/pack-objects-bigfile' into maint
* jc/pack-objects-bigfile:
  Teach core.bigfilethreashold to pack-objects
2011-05-04 14:57:38 -07:00
Junio C Hamano
f6bfe76714 Merge branch 'mg/reflog-with-options' into maint
* mg/reflog-with-options:
  reflog: fix overriding of command line options
  t/t1411: test reflog with formats
  builtin/log.c: separate default and setup of cmd_log_init()
2011-05-04 14:57:33 -07:00
Junio C Hamano
0752000c2a Merge branch 'jk/stash-loosen-safety' into maint
* jk/stash-loosen-safety:
  stash: drop dirty worktree check on apply
2011-05-04 14:57:15 -07:00
Junio C Hamano
391b493344 Merge branch 'ar/clean-rmdir-empty' into maint
* ar/clean-rmdir-empty:
  clean: unreadable directory may still be rmdir-able if it is empty
2011-05-04 14:57:06 -07:00
Junio C Hamano
a3402c18b6 Merge branch 'mg/sha1-path-advise' into maint
* mg/sha1-path-advise:
  sha1_name: Suggest commit:./file for path in subdir
  t1506: factor out test for "Did you mean..."
2011-05-04 14:56:51 -07:00
Valentin Haenel
d022443604 git-add.txt: document 'add.ignoreErrors'
Signed-off-by: Valentin Haenel <valentin.haenel@gmx.de>
Noticed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-04 14:52:30 -07:00
Tay Ray Chuan
0cc6330d0c t5541-http-push: add test for chunked
Trigger the chunked type of pushing for smart HTTP. This can serve as a
regression test for the issue fixed in 1e41827 (http: clear POSTFIELDS
when initializing a slot).

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-04 13:30:37 -07:00
Dan McGee
ebaaf316ca http-push: refactor curl_easy_setup madness
We were doing (nearly) the same thing all over the place, in slightly
different orders, different variable names, etc. Refactor most calls
into two helper functions, one for GET and one for everything else, that
do the heavy lifting leaving most callsites a lot cleaner in the
process.

Note that the setting of CURLOPT_PUT at the callsites of
curl_setup_http() which previously didn't do it (eg.
locking_available(), remote_ls()) is safe, since that
option is deprecated in libcurl in place of, and has the same effect as,
CURLOPT_UPLOAD.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-04 13:30:28 -07:00
Dan McGee
2aab167adf http-push: use const for strings in signatures
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-04 13:30:28 -07:00
Dan McGee
a04ff3ec32 http: make curl callbacks match contracts from curl header
Yes, these don't match perfectly with the void* first parameter of the
fread/fwrite in the standard library, but they do match the curl
expected method signature. This is needed when a refactor passes a
curl_write_callback around, which would otherwise give incorrect
parameter warnings.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-04 13:30:28 -07:00
Junio C Hamano
0b9deecf62 Update draft release notes to 1.7.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-02 16:10:50 -07:00
Junio C Hamano
23f536cf62 Merge branch 'jk/notes-ui-updates'
* jk/notes-ui-updates:
  contrib/completion: --notes, --no-notes
  log/pretty-options: Document --[no-]notes and deprecate old notes options
  revision.c: make --no-notes reset --notes list
  revision.c: support --notes command-line option
  notes: refactor display notes default handling
  notes: refactor display notes extra refs field
  revision.c: refactor notes ref expansion
  notes: make expand_notes_ref globally accessible
2011-05-02 15:58:50 -07:00
Junio C Hamano
a75c3523d3 Merge branch 'ab/i18n-fixup'
* ab/i18n-fixup: (24 commits)
  i18n: use test_i18n{cmp,grep} in t7600, t7607, t7611 and t7811
  i18n: use test_i18n{grep,cmp} in t7508
  i18n: use test_i18ngrep in t7506
  i18n: use test_i18ngrep and test_i18ncmp in t7502
  i18n: use test_i18ngrep in t7501
  i18n: use test_i18ncmp in t7500
  i18n: use test_i18ngrep in t7201
  i18n: use test_i18ncmp and test_i18ngrep in t7102 and t7110
  i18n: use test_i18ncmp and test_i18ngrep in t5541, t6040, t6120, t7004, t7012 and t7060
  i18n: use test_i18ncmp and test_i18ngrep in t3700, t4001 and t4014
  i18n: use test_i18ncmp and test_i18ngrep in t3203, t3501 and t3507
  i18n: use test_i18ngrep in t2020, t2204, t3030, and t3200
  i18n: use test_i18ngrep in lib-httpd and t2019
  i18n: do not overuse C_LOCALE_OUTPUT (grep)
  i18n: use test_i18ncmp in t1200 and t2200
  i18n: .git file is not a human readable message (t5601)
  i18n: do not overuse C_LOCALE_OUTPUT
  i18n: mark init-db messages for translation
  i18n: mark checkout plural warning for translation
  i18n: mark checkout --detach messages for translation
  ...
2011-05-02 15:58:40 -07:00
Junio C Hamano
0d405d72f5 Merge branch 'nm/submodule-update-force'
* nm/submodule-update-force:
  submodule: Add --force option for git submodule update

Conflicts:
	t/t7406-submodule-update.sh
2011-05-02 15:58:36 -07:00
Junio C Hamano
2d23c64ba2 Merge branch 'jh/notes-add-ui'
* jh/notes-add-ui:
  Make "git notes add" more user-friendly when there are existing notes

Conflicts:
	builtin/notes.c
2011-05-02 15:58:32 -07:00
Junio C Hamano
c67e367c50 Merge branch 'nd/maint-setup'
* nd/maint-setup:
  Kill off get_relative_cwd()
  setup: return correct prefix if worktree is '/'

Conflicts:
	dir.c
	setup.c
2011-05-02 15:58:30 -07:00
Junio C Hamano
2db8926236 Merge branch 'mz/maint-rename-unmerged'
* mz/maint-rename-unmerged:
  diffcore-rename: don't consider unmerged path as source
2011-05-02 15:58:27 -07:00
Jonathan Nieder
239b5ed9c9 Documentation: clarify meaning of --html-path, --man-path, and --info-path
These options tell UI programs where git put its documentation, so
"Help" actions can show the documentation for *this* version of git
without regard to how MANPATH and INFOPATH are set up.  Details:

. Each variable tells where documentation is expected to be.  They do
  not indicate whether documentation was actually installed.

. The output of "git --html-path" is an absolute path and can be used
  in "file://$(git --html-path)/git-add.html" to name the HTML file
  documenting a particular command.

. --man-path names a manual page hierarchy (e.g.,
  /home/user/share/man).  Its output can be passed to "man -M" or put
  at the beginning of $MANPATH.

. --info-path names a directory with info files (e.g.,
  /home/user/share/info).  Its output is suitable as an argument to
  "info -d" or for inclusion in $INFOPATH.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-02 08:49:32 -07:00
Jon Seymour
f2dd8c3799 git: add --info-path and --man-path options
Similar to the way the --html-path option lets UI programs learn where git
has its HTML documentation pages, expose the other two paths used to store
the documentation pages of these two types.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-01 21:50:04 -07:00
Junio C Hamano
791a765e54 Update draft release notes to 1.7.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-01 16:29:43 -07:00
Junio C Hamano
5ae6f5ca2f Merge branch 'rs/strbuf-setlen-assert'
* rs/strbuf-setlen-assert:
  strbuf: clarify assertion in strbuf_setlen()
2011-05-01 16:25:04 -07:00
Junio C Hamano
638e90c235 Merge branch 'vh/git-svn-doc'
* vh/git-svn-doc:
  git-svn.txt: small typeface improvements
  git-svn.txt: move option descriptions
  git-svn.txt: fix usage of --add-author-from
2011-05-01 16:25:01 -07:00
Ciaran Jessup
0a0ec7bd66 Pass empty file to p4merge where no base is suitable.
Modify the p4merge client command to pass a reference to an empty file
instead of the local file when no base revision available.

In the situation where a merge tries to add a file from one branch
into a branch that already contains that file (by name), p4merge
currently seems to have successfully automatically resolved the
'conflict' when it is opened (correctly if the files differed by
just whitespace for example) but leaves the save button disabled. This
means the user of the p4merge client cannot commit the resolved
changes back to disk and merely exits, leaving the original
(merge-conflicted) file intact on the disk.

Provide an empty base file to p4merge so that it leaves the save
button enabled.  This will allow saving of the auto-resolution to
disk.

Signed-off-by: Ciaran Jessup <ciaranj@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-01 15:56:05 -07:00
Guy Rouillier
58fdef0cff Look for password in both CVS and CVSNT password files.
In conn, if password is not passed on command line, look for a password
entry in both the CVS password file and the CVSNT password file.  If only
one file is found and the requested repository is in that file, or if both
files are found but the requested repository is found in only one file, use
the password from the single file containing the repository entry.  If both
files are found and the requested repository is found in both files, then
produce an error message.

The CVS password file separates tokens with a space character, while
the CVSNT password file separates tokens with an equal (=) character.
Add a sub find_password_entry that accepts the password file name
and a delimiter to eliminate code duplication.

Signed-off-by: Guy Rouillier <guyr@burntmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-01 11:42:59 -07:00
Jeff King
6aaeca900b merge-one-file: fix broken merges with alternate work trees
The merge-one-file tool predates the invention of
GIT_WORK_TREE. By the time GIT_WORK_TREE was invented, most
people were using the merge-recursive strategy, which
handles resolving internally. Therefore these features have
had very little testing together.

For the most part, merge-one-file just works with
GIT_WORK_TREE; most of its heavy lifting is done by plumbing
commands which do respect GIT_WORK_TREE properly. The one
exception is a shell redirection which touches the worktree
directly, writing results to the wrong place in the presence
of a GIT_WORK_TREE variable.

This means that merges won't even fail; they will silently
produce incorrect results, throwing out the entire "theirs"
side of files which need content-level merging!

This patch makes merge-one-file chdir to the toplevel of the
working tree (and exit if we don't have one). This most
closely matches the assumption made by the original script
(before separate work trees were invented), and matches what
happens when the script is called as part of a merge
strategy.

While we're at it, we'll also error-check the call to cat.
Merging a file in a subdirectory could in fact fail, as the
redirection relies on the "checkout-index" call just prior
to create leading directories. But we never noticed, since
we ignored the error return from running cat.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 15:37:43 -07:00
Jeff King
cf1af1b1f3 add tests for merge-index / merge-one-file
There were no tests for either, except a brief use in
t1200-tutorial.

These tools are not used much these days, as most people
use the merge-recursive strategy, which handles everything
internally. However, they are used by the "octopus" and
"resolve" strategies, as well as any custom strategies
or merge scripts people have built around them.

For example, together with read-tree, they are the simplest
way to do a basic content-level merge without checking out
the entire repository contents beforehand.

This script adds a basic test of the tools to perform one
content-level merge. It also shows a failure of the tools to
work properly in the face of GIT_WORK_TREE or core.worktree.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 15:37:08 -07:00
Junio C Hamano
933e44d3a0 "add -p": work-around an old laziness that does not coalesce hunks
Since 0beee4c (git-add--interactive: remove hunk coalescing, 2008-07-02),
"git add--interactive" behaves lazily and passes overlapping hunks to the
underlying "git apply" without coalescing.  This was partially corrected
by 7a26e65 (its partial revert, 2009-05-16), but overlapping hunks are
still passed when the patch is edited.

Teach "git apply" the --allow-overlap option that disables a safety
feature that avoids misapplication of patches by not applying patches
to overlapping hunks, and pass this option form "add -p" codepath.

Do not even advertise the option, as this is merely a workaround, and the
correct fix is to make "add -p" correctly coalesce adjacent patch hunks.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 15:27:59 -07:00
Junio C Hamano
9dce832354 add--interactive.perl: factor out repeated --recount option
Depending on the direction and the target of patch application, we would
need to pass --cached and --reverse to underlying "git apply".  Also we
only pass --check when we are not applying but just checking.

But we always pass --recount since 8cbd431 (git-add--interactive: replace
hunk recounting with apply --recount, 2008-07-02).  Instead of repeating
the same --recount over and over again, move it to a single place that
actually runs the command, namely, "run_git_apply" subroutine.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 15:27:59 -07:00
Junio C Hamano
f3217e2b17 t3701: Editing a split hunk in an "add -p" session
Arnaud Lacombe reported that with the recent change to reject overlapping
hunks fed to "git apply", the edit mode of an "add -p" session that lazily
feeds overlapping hunks without coalescing adjacent ones claim that the
patch does not apply.  Expose the problem to be fixed.

Cf. http://thread.gmane.org/gmane.comp.version-control.git/170685/focus=171000

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 15:26:41 -07:00
Junio C Hamano
f5ea3f2bb3 add -p: 'q' should really quit
The "quit" command was added in 9a7a1e0 (git add -p: new "quit" command at
the prompt, 2009-04-10) to allow the user to say that hunks other than
what have already been chosen are undesirable, and exit the interactive
loop immediately.  It forgot that there may be an undecided hunk before
the current one.  In such a case, the interactive loop still goes back to
the beginning.

Clear all the USE bit for undecided hunks and exit the loop.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 15:25:03 -07:00
Jakub Narebski
4b9447f98e gitweb: Mark matched 'ctag' / contents tag (?by_tag=foo)
It might have been hard to discover that current view is limited to
projects with given content tag (ctag), as it was distinquished only
in gitweb URL.  Mark matched contents tag in the tag cloud using
"match" class, for easier discovery.

This commit introduces a bit of further code duplication in
git_populate_project_tagcloud().

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 14:21:48 -07:00
Jakub Narebski
0368c492d6 gitweb: Change the way "content tags" ('ctags') are handled
The major change is removing the ability to edit content tags (ctags)
in a web browser.

The interface was created by gitweb, while actual editing of tags was
to be done by external script; the API was not defined, and neither
was provided example implementation.  Such split is also a bit fragile
- interface and implementation have to be kept in sync.  Gitweb
provided only ability to add tags; you could not edit tags nor delete
them.

Format of ctags is now described in the comment above git_get_project_ctags
subroutine.  Gitweb now is more robust with respect to original ctags
format; it also accepts two new formats: $GIT_DIR/ctags file, with one
content tag per line, and multi-value `gitweb.ctag' config variable.

Gathering all ctags of all project is now put in git_gather_all_ctags
subroutine, making git_project_list_body more clear.

git_populate_project_tagcloud subroutine now generates data used for
tag cloud, including generation of ctag link, also in the case
HTML::TagCloud module is unavailable.  Links are now generated using
href() subroutine - this is more robust, as ctags might contain '?',
';' and '=' special characters that need to be escaped in query param.
Shown tags are HTML-escaped.

The generation of tag cloud in git_show_project_tagcloud in the case
when HTML::TagCloud is not available is now changed slightly.

The 'content tags' field on project summary page is made more in line
with other fields in "projects_list" table.  Because one cannot now
add new tags from web interface, this field is no longer displayed
when there are no content tags for given project.

Ctags-issue-Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Ctags-issue-Reported-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 14:21:48 -07:00
Jakub Narebski
12b1443c2c gitweb: Restructure projects list generation
Extract filtering out forks (which is done if 'forks' feature is
enabled) into filter_forks_from_projects_list subroutine, and
searching projects (via projects search form, or via content tags)
into search_projects_list subroutine.

Both are now run _before_ displaying projects, and not while printing;
this allow to know upfront if there were any found projects.  Gitweb
now can and do print 'No such projects found' if user searches for
phrase which does not correspond to any project (any repository).
This also would allow splitting projects list into pages, if we so
desire.

Filtering out forks and marking repository (project) as having forks
is now consolidated into one subroutine (special case of handling
forks in git_get_projects_list only for $projects_list being file is
now removed).  Forks handling is also cleaned up and simplified.
$pr->{'forks'} now contains un-filled list of forks; we can now also
detect situation where the way for having forks is prepared, but there
are no forks yet.

Sorting projects got also refactored in a very straight way (just
moving code) into sort_projects_list subroutine.

The interaction between forks, content tags and searching is now made
more explicit: searching whether by tag, or via search form turns off
fork filtering (gitweb searches also forks, and will show all
results).  If 'ctags' feature is disabled, then searching by tag is
too.

The t9500 test now includes some basic test for 'forks' and 'ctags'
features; the t9502 includes test checking if gitweb correctly filters
out forks.

Generating list of projects by scanning given directory is now also a
bit simplified wrt. handling filtering; it is byproduct of extracting
filtering forks to separate subroutine.

While at it we now detect that there are no projects and respond with
"404 No projects found" also for 'project_index' and 'opml' actions.

Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 14:21:48 -07:00
Junio C Hamano
1c08bf50cf Merge branch 'maint'
* maint:
  Start 1.7.5.1 maintenance track
  git-send-email: fix missing space in error message

Conflicts:
	RelNotes
2011-04-29 11:48:13 -07:00
Junio C Hamano
65f13f20bc Start 1.7.5.1 maintenance track
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 11:47:35 -07:00
Junio C Hamano
04a67dc622 Merge branch 'mg/x-years-12-months' into maint
* mg/x-years-12-months:
  date: avoid "X years, 12 months" in relative dates
2011-04-29 11:43:18 -07:00
Sylvain Rabot
a1dd7e16ad git-send-email: fix missing space in error message
When the command cannot make a connection to the SMTP server the error
message to diagnose the broken configuration is issued.  However, when an
optional smtp-server-port is given and needs to be reported, the message
lacked a space between "hello=<smtp-domain>" and "port=<smtp-server-port>".

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 11:34:32 -07:00
Johan Herland
7478ac57c4 Mark dirstat error messages for translation
Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 11:22:56 -07:00
Johan Herland
51670fc87e Improve error handling when parsing dirstat parameters
When encountering errors or unknown tokens while parsing parameters to the
--dirstat option, it makes sense to die() with an error message informing
the user of which parameter did not make sense. However, when parsing the
diff.dirstat config variable, we cannot simply die(), but should instead
(after warning the user) ignore the erroneous or unrecognized parameter.
After all, future Git versions might add more dirstat parameters, and
using two different Git versions on the same repo should not cripple the
older Git version just because of a parameter that is only understood by
a more recent Git version.

This patch fixes the issue by refactoring the dirstat parameter parsing
so that parse_dirstat_params() keeps on parsing parameters, even if an
earlier parameter was not recognized. When parsing has finished, it returns
zero if all parameters were successfully parsed, and non-zero if one or
more parameters were not recognized (with appropriate error messages
appended to the 'errmsg' argument).

The parse_dirstat_params() callers then decide (based on the return value
from parse_dirstat_params()) whether to warn and ignore (in case of
diff.dirstat), or to warn and die (in case of --dirstat).

The patch also adds a couple of tests verifying the correct behavior of
--dirstat and diff.dirstat in the face of unknown (possibly future) dirstat
parameters.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 11:22:56 -07:00
Johan Herland
1c57a627bf New --dirstat=lines mode, doing dirstat analysis based on diffstat
This patch adds an alternative implementation of show_dirstat(), called
show_dirstat_by_line(), which uses the more expensive diffstat analysis
(as opposed to show_dirstat()'s own (relatively inexpensive) analysis)
to derive the numbers from which the --dirstat output is computed.

The alternative implementation is controlled by the new "lines" parameter
to the --dirstat option (or the diff.dirstat config variable).

For binary files, the diffstat analysis counts bytes instead of lines,
so to prevent binary files from dominating the dirstat results, the
byte counts for binary files are divided by 64 before being compared to
their textual/line-based counterparts. This is a stupid and ugly - but
very cheap - heuristic.

In linux-2.6.git, running the three different --dirstat modes:

  time git diff v2.6.20..v2.6.30 --dirstat=changes > /dev/null
vs.
  time git diff v2.6.20..v2.6.30 --dirstat=lines > /dev/null
vs.
  time git diff v2.6.20..v2.6.30 --dirstat=files > /dev/null

yields the following average runtimes on my machine:

 - "changes" (default): ~6.0 s
 - "lines":             ~9.6 s
 - "files":             ~0.1 s

So, as expected, there's a considerable performance hit (~60%) by going
through the full diffstat analysis as compared to the default "changes"
analysis (obviously, "files" is much faster than both). As such, the
"lines" mode is probably only useful if you really need the --dirstat
numbers to be consistent with the numbers returned from the other
--*stat options.

The patch also includes documentation and tests for the new dirstat mode.

Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 11:22:55 -07:00
Johan Herland
712d2c7dd8 Allow specifying --dirstat cut-off percentage as a floating point number
Only the first digit after the decimal point is kept, as the dirstat
calculations all happen in permille.

Selftests verifying floating-point percentage input has been added.

Improved-by: Junio C Hamano <gitster@pobox.com>
Improved-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 11:20:11 -07:00
Johan Herland
2d17495196 Add config variable for specifying default --dirstat behavior
The new diff.dirstat config variable takes the same arguments as
'--dirstat=<args>', and specifies the default arguments for --dirstat.
The config is obviously overridden by --dirstat arguments passed on the
command line.

When not specified, the --dirstat defaults are 'changes,noncumulative,3'.

The patch also adds several tests verifying the interaction between the
diff.dirstat config variable, and the --dirstat command line option.

Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 11:20:03 -07:00
Johan Herland
333f3fb0c5 Refactor --dirstat parsing; deprecate --cumulative and --dirstat-by-file
Instead of having multiple interconnected dirstat-related options, teach
the --dirstat option itself to accept all behavior modifiers as parameters.

 - Preserve the current --dirstat=<limit> (where <limit> is an integer
   specifying a cut-off percentage)
 - Add --dirstat=cumulative, replacing --cumulative
 - Add --dirstat=files, replacing --dirstat-by-file
 - Also add --dirstat=changes and --dirstat=noncumulative for specifying the
   current default behavior. These allow the user to reset other --dirstat
   parameters (e.g. 'cumulative' and 'files') occuring earlier on the
   command line.

The deprecated options (--cumulative and --dirstat-by-file) are still
functional, although they have been removed from the documentation.

Allow multiple parameters to be separated by commas, e.g.:
  --dirstat=files,10,cumulative

Update the documentation accordingly, and add testcases verifying the
behavior of the new syntax.

Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 11:17:36 -07:00
Johan Herland
58a8756a98 Make --dirstat=0 output directories that contribute < 0.1% of changes
The expected output from --dirstat=0, is to include any directory with
changes, even if those changes contribute a minuscule portion of the total
changes. However, currently, directories that contribute less than 0.1% are
not included, since their 'permille' value is 0, and there is an
'if (permille)' check in gather_dirstat() that causes them to be ignored.

This test is obviously intended to exclude directories that contribute no
changes whatsoever, but in this case, it hits too broadly. The correct
check is against 'this_dir' from which the permille is calculated. Only if
this value is 0 does the directory truly contribute no changes, and should
be skipped from the output.

This patches fixes this issue, and updates corresponding testcases to
expect the new behvaior.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 11:17:36 -07:00