git
17 years agoMerge branch 'js/rebase'
Junio C Hamano [Mon, 2 Jul 2007 08:45:47 +0000 (01:45 -0700)] 
Merge branch 'js/rebase'

* js/rebase:
  Teach rebase -i about --preserve-merges
  rebase -i: provide reasonable reflog for the rebased branch
  rebase -i: several cleanups
  ignore git-rebase--interactive
  Teach rebase an interactive mode
  Move the pick_author code to git-sh-setup

17 years agoMerge branch 'jc/diffcore'
Junio C Hamano [Mon, 2 Jul 2007 08:45:12 +0000 (01:45 -0700)] 
Merge branch 'jc/diffcore'

* jc/diffcore:
  diffcore-delta.c: Ignore CR in CRLF for text files
  diffcore-delta.c: update the comment on the algorithm.
  diffcore_filespec: add is_binary
  diffcore_count_changes: pass diffcore_filespec

17 years agoDocumentation: minor cleanups to branch/checkout wording
Jeff King [Mon, 2 Jul 2007 05:28:20 +0000 (01:28 -0400)] 
Documentation: minor cleanups to branch/checkout wording

Change "to made" to "made to", which is a typo. Use "reflog"
instead of "ref log", which is used elsewhere throughout the
documentation.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoDocumentation: quote {non-attributes} for asciidoc
Jeff King [Mon, 2 Jul 2007 05:24:59 +0000 (01:24 -0400)] 
Documentation: quote {non-attributes} for asciidoc

Asciidoc treats {foo} as an attribute to be substituted; if
'foo' doesn't exist as an attribute, then the entire line
gets dropped. When the literal {foo} is desired, \{foo} is
required.

The exceptions to this rule are:
  - inside literal blocks
  - if the 'foo' contains non-alphanumeric characters (e.g.,
    {foo|bar} is assumed not to be an attribute)

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMake '!' aliases more useful
Johannes Schindelin [Sun, 1 Jul 2007 21:51:58 +0000 (22:51 +0100)] 
Make '!' aliases more useful

When an alias starts with an exclamation mark, the rest is interpreted
as a shell command. However, all arguments passed to git used to be
ignored.

Now you can have an alias like

$ git config alias.e '!echo'

and

$ git e Hello World

does what you expect it to do.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogetenv/setenv: use constants if available
Matthias Lederhofer [Thu, 28 Jun 2007 14:15:25 +0000 (16:15 +0200)] 
getenv/setenv: use constants if available

There were places using "GIT_DIR" instead of GIT_DIR_ENVIRONMENT and
"GIT_CONFIG" instead of CONFIG_ENVIRONMENT.  This makes it easier to
find all places touching an environment variable using git grep or
similar tools.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-clone: fetch possibly detached HEAD over dumb http
Sven Verdoolaege [Fri, 29 Jun 2007 08:31:08 +0000 (10:31 +0200)] 
git-clone: fetch possibly detached HEAD over dumb http

git-clone supports cloning from a repo with detached HEAD,
but if this HEAD is not behind any branch tip then it
would not have been fetched over dumb http, resulting in a

fatal: Not a valid object name HEAD

Since 928c210a, this would also happen on a http repo
with a HEAD that is a symbolic link where someone has
forgotton to run update-server-info.

Signed-off-by: Sven Verdoolaege <skimo@liacs.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-submodule: Instead of using only annotated tags, use any tags.
Emil Medve [Tue, 26 Jun 2007 23:40:58 +0000 (18:40 -0500)] 
git-submodule: Instead of using only annotated tags, use any tags.

Some repositories might not use/have annotated tags (for example the
ones created with git-cvsimport) and git-submodule status might fail
because git-describe might fail to find a tag.  This change allows the
status of a submodule to be described/displayed relative to lightweight
tags as well.

Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-submodule: provide easy way of adding new submodules
Sven Verdoolaege [Sun, 24 Jun 2007 21:06:07 +0000 (23:06 +0200)] 
git-submodule: provide easy way of adding new submodules

To make a submodule effectively usable, the path and
a URL where the submodule can be cloned need to be stored
in .gitmodules.  This subcommand takes care of setting
this information after cloning the new submodule.
Only the index is updated, so, if needed, the user may still
change the URL or switch to a different branch of the submodule
before committing.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoUpdate public documentation links for 1.5.2.3
Junio C Hamano [Mon, 2 Jul 2007 08:14:00 +0000 (01:14 -0700)] 
Update public documentation links for 1.5.2.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge 1.5.2.3 in
Junio C Hamano [Mon, 2 Jul 2007 08:12:57 +0000 (01:12 -0700)] 
Merge 1.5.2.3 in

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoGIT 1.5.2.3 v1.5.2.3
Junio C Hamano [Mon, 2 Jul 2007 07:35:58 +0000 (00:35 -0700)] 
GIT 1.5.2.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge branch 'rs/diff'
Junio C Hamano [Sun, 1 Jul 2007 21:58:09 +0000 (14:58 -0700)] 
Merge branch 'rs/diff'

* rs/diff:
  diff: round down similarity index
  diffcore-rename: don't change similarity index based on basename equality

17 years agoMerge branch 'jc/quote'
Junio C Hamano [Sun, 1 Jul 2007 21:57:51 +0000 (14:57 -0700)] 
Merge branch 'jc/quote'

* jc/quote:
  Add core.quotepath configuration variable.

17 years agoFix t5516-fetch for systems where `wc -l` outputs whitespace.
Brian Gernhardt [Sun, 1 Jul 2007 15:48:54 +0000 (11:48 -0400)] 
Fix t5516-fetch for systems where `wc -l` outputs whitespace.

When wc outputs whitespace, the test "$(command | wc -l)" = 1 is
broken because "   1" != "1".  Let the shell eat the whitespace by
using test 1 = $(command | wc -l) instead.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit add: respect core.filemode with unmerged entries
Johannes Schindelin [Fri, 29 Jun 2007 17:32:46 +0000 (18:32 +0100)] 
git add: respect core.filemode with unmerged entries

When a merge left unmerged entries, git add failed to pick up the
file mode from the index, when core.filemode == 0. If more than one
unmerged entry is there, the order of stage preference is 2, 1, 3.

Noticed by Johannes Sixt.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agot7004: ship trustdb to avoid gpg warnings
Johannes Schindelin [Sun, 1 Jul 2007 03:14:01 +0000 (20:14 -0700)] 
t7004: ship trustdb to avoid gpg warnings

This avoids warning messages from gpg while verifying the tags; without it,
the program complains that the key is not certified with a trusted signature.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge branch 'ml/worktree'
Junio C Hamano [Sun, 1 Jul 2007 20:11:01 +0000 (13:11 -0700)] 
Merge branch 'ml/worktree'

* ml/worktree:
  make git barf when an alias changes environment variables

17 years agoMerge branch 'ei/worktree+filter'
Junio C Hamano [Sun, 1 Jul 2007 20:10:42 +0000 (13:10 -0700)] 
Merge branch 'ei/worktree+filter'

* ei/worktree+filter:
  filter-branch: always export GIT_DIR if it is set
  setup_git_directory: fix segfault if repository is found in cwd
  test GIT_WORK_TREE
  extend rev-parse test for --is-inside-work-tree
  Use new semantics of is_bare/inside_git_dir/inside_work_tree
  introduce GIT_WORK_TREE to specify the work tree
  test git rev-parse
  rev-parse: introduce --is-bare-repository
  rev-parse: document --is-inside-git-dir

17 years agoMerge branch 'fl/config'
Junio C Hamano [Sun, 1 Jul 2007 06:49:01 +0000 (23:49 -0700)] 
Merge branch 'fl/config'

* fl/config:
  config: add support for --bool and --int while setting values

17 years agoMerge branch 'mk/svn'
Junio C Hamano [Sun, 1 Jul 2007 06:48:54 +0000 (23:48 -0700)] 
Merge branch 'mk/svn'

* mk/svn:
  git-svn: honor ~/.subversion/ client cert file settings.

17 years agogit-svn: cache max revision in rev_db databases
Sam Vilain [Sat, 30 Jun 2007 08:56:14 +0000 (20:56 +1200)] 
git-svn: cache max revision in rev_db databases

Cache the maximum revision for each rev_db URL rather than looking it
up each time.  This saves a lot of time when rebuilding indexes on a
freshly cloned repository.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-svn: use git-log rather than rev-list | xargs cat-file
Sam Vilain [Sat, 30 Jun 2007 08:56:13 +0000 (20:56 +1200)] 
git-svn: use git-log rather than rev-list | xargs cat-file

This saves a bit of time when rebuilding the git-svn index.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-svn: honor ~/.subversion/ client cert file settings.
Michael Krelin [Fri, 22 Jun 2007 09:15:03 +0000 (11:15 +0200)] 
git-svn: honor ~/.subversion/ client cert file settings.

Currently, whenever svn repository http server requests client
certificate, prompt provider is invoked, ignoring any
ssl-client-cert-file settings in ~/.subversion/servers.

Moreover, it happens more than once per session, which is quite
irritating.

Signed-off-by: Michael Krelin <hacker@klever.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agodiffcore-delta.c: Ignore CR in CRLF for text files
Junio C Hamano [Fri, 29 Jun 2007 06:14:13 +0000 (23:14 -0700)] 
diffcore-delta.c: Ignore CR in CRLF for text files

This ignores CR byte in CRLF sequence in text file when
computing similarity of two blobs.

Usually this should not matter as nobody sane would be checking
in a file with CRLF line endings to the repository (they would
use autocrlf so that the repository copy would have LF line
endings).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agodiffcore-delta.c: update the comment on the algorithm.
Junio C Hamano [Fri, 29 Jun 2007 06:11:40 +0000 (23:11 -0700)] 
diffcore-delta.c: update the comment on the algorithm.

The comment at the top of the file described an old algorithm
that was neutral to text/binary differences (it hashed sliding
window of N-byte sequences and counted overlaps), but long time
ago we switched to a new heuristics that are more suitable for
line oriented (read: text) files that are much faster.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agodiffcore_filespec: add is_binary
Junio C Hamano [Fri, 29 Jun 2007 05:56:07 +0000 (22:56 -0700)] 
diffcore_filespec: add is_binary

diffcore-break and diffcore-rename would want to behave slightly
differently depending on the binary-ness of the data, so add one
bit to the filespec, as the structure is now passed down to
diffcore_count_changes() function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agodiffcore_count_changes: pass diffcore_filespec
Junio C Hamano [Fri, 29 Jun 2007 05:54:37 +0000 (22:54 -0700)] 
diffcore_count_changes: pass diffcore_filespec

We may want to use richer information on the data we are dealing
with in this function, so instead of passing a buffer address
and length, just pass the diffcore_filespec structure.  Existing
callers always call this function with parameters taken from a
filespec anyway, so there is no functionality changes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoDon't fflush(stdout) when it's not helpful
Theodore Ts'o [Fri, 29 Jun 2007 17:40:46 +0000 (13:40 -0400)] 
Don't fflush(stdout) when it's not helpful

This patch arose from a discussion started by Jim Meyering's patch
whose intention was to provide better diagnostics for failed writes.
Linus proposed a better way to do things, which also had the added
benefit that adding a fflush() to git-log-* operations and incremental
git-blame operations could improve interactive respose time feel, at
the cost of making things a bit slower when we aren't piping the
output to a downstream program.

This patch skips the fflush() calls when stdout is a regular file, or
if the environment variable GIT_FLUSH is set to "0".  This latter can
speed up a command such as:

GIT_FLUSH=0 strace -c -f -e write time git-rev-list HEAD | wc -l

a tiny amount.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge branch 'cr/tag'
Junio C Hamano [Sat, 30 Jun 2007 19:06:44 +0000 (12:06 -0700)] 
Merge branch 'cr/tag'

* cr/tag:
  Add test-script for git-tag
  Add test script for git-stripspace.
  Fix git-stripspace to process correctly long lines and spaces.

17 years agogit: Try a bit harder not to lose errno in stdio
Linus Torvalds [Sat, 30 Jun 2007 18:44:20 +0000 (11:44 -0700)] 
git: Try a bit harder not to lose errno in stdio

This switches the checks around upon the exit codepath of the
git wrapper, so that we may recover at least non-transient errors.

It's still not perfect. As I've been harping on, stdio simply isn't very
good for error reporting. For example, if an IO error happened, you'd want
to see EIO, wouldn't you? And yes, that's what the kernel would return.
However, with buffered stdio (and flushing outside of our control), what
would likely happen is that some intermediate error return _does_ return
EIO, but then the kernel might decide to re-mount the filesystem read-only
due to the error, and the actual *report* for us might be

"write failure on standard output: read-only filesystem"

which lost the EIO.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge branch 'lt/run'
Junio C Hamano [Sat, 30 Jun 2007 18:22:08 +0000 (11:22 -0700)] 
Merge branch 'lt/run'

* lt/run:
  Check for IO errors after running a command
  Clean up internal command handling

17 years agoMerge branch 'maint'
Junio C Hamano [Sat, 30 Jun 2007 18:17:19 +0000 (11:17 -0700)] 
Merge branch 'maint'

* maint:
  Correct the name of NO_R_TO_GCC_LINKER in the comment describing it.
  git-remote: document -n
  repack: improve documentation on -a option

17 years agoCorrect the name of NO_R_TO_GCC_LINKER in the comment describing it.
Matt Kraai [Sat, 30 Jun 2007 17:05:03 +0000 (10:05 -0700)] 
Correct the name of NO_R_TO_GCC_LINKER in the comment describing it.

Signed-off-by: Matt Kraai <kraai@ftbfs.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-remote: document -n
Sam Vilain [Sat, 30 Jun 2007 08:56:16 +0000 (20:56 +1200)] 
git-remote: document -n

The 'show' and 'prune' commands accept an option '-n'; document what
it does.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agorepack: improve documentation on -a option
Sam Vilain [Sat, 30 Jun 2007 08:56:12 +0000 (20:56 +1200)] 
repack: improve documentation on -a option

Some minor enhancements to the git-repack manual page.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-tag: Fix "can't shift that many".
Alexandre Vassalotti [Thu, 28 Jun 2007 16:56:57 +0000 (12:56 -0400)] 
git-tag: Fix "can't shift that many".

This stop git-tag from emitting a "shift: can't shift that many"
error, when listing tags.

[jc: with further fixups from Sam Vilain merged in; it passes
 the tests under dash now]

Signed-off-by: Alexandre Vassalotti <alexandre@peadrop.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoCorrect usages of sed in git-tag for Mac OS X
Shawn O. Pearce [Sat, 30 Jun 2007 06:42:47 +0000 (02:42 -0400)] 
Correct usages of sed in git-tag for Mac OS X

Both `git-tag -l` and `git tag -v` fail on Mac OS X due to their
non-standard uses of sed.  Actually `git tag -v` fails because the
underlying git-tag-verify uses a non-standard sed command.

We now stick to only standard sed, which does make our sed scripts
slightly more complicated, but we can actually list tags with more
than 0 lines of additional context and we can verify signed tags
with gpg.  These major Git functions are much more important than
saving two or three lines of a simple sed script.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoUpdate draft Release Notes for 1.5.3
Junio C Hamano [Fri, 29 Jun 2007 16:20:06 +0000 (09:20 -0700)] 
Update draft Release Notes for 1.5.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge branch 'maint'
Junio C Hamano [Fri, 29 Jun 2007 05:05:30 +0000 (22:05 -0700)] 
Merge branch 'maint'

* maint:

17 years agoMerge branch 'master' of git://repo.or.cz/git-gui
Junio C Hamano [Fri, 29 Jun 2007 04:32:41 +0000 (21:32 -0700)] 
Merge branch 'master' of git://repo.or.cz/git-gui

* 'master' of git://repo.or.cz/git-gui:
  git-gui: Don't require a .pvcsrc to create Tools/Migrate menu hack
  git-gui: Don't nice git blame on MSYS as nice is not supported
  git-gui: Don't require $DISPLAY just to get --version
  git-gui: Quiet our installation process
  git-gui: Bind Tab/Shift-Tab to cycle between panes in blame
  git-gui: Correctly install to /usr/bin on Cygwin

17 years agoMerge branch 'maint' of git://repo.or.cz/git-gui into maint
Junio C Hamano [Fri, 29 Jun 2007 04:28:36 +0000 (21:28 -0700)] 
Merge branch 'maint' of git://repo.or.cz/git-gui into maint

* 'maint' of git://repo.or.cz/git-gui:
  git-gui: Don't require a .pvcsrc to create Tools/Migrate menu hack
  git-gui: Don't nice git blame on MSYS as nice is not supported
  git-gui: Don't require $DISPLAY just to get --version
  git-gui: Bind Tab/Shift-Tab to cycle between panes in blame
  git-gui: Correctly install to /usr/bin on Cygwin

17 years agoAvoid perl in t1300-repo-config
Alex Riesen [Wed, 27 Jun 2007 12:40:41 +0000 (14:40 +0200)] 
Avoid perl in t1300-repo-config

It fixes the test on system where ActiveState Perl is used.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-cvsimport: force checkout of working tree after initial import
Gerrit Pape [Thu, 28 Jun 2007 11:12:07 +0000 (11:12 +0000)] 
git-cvsimport: force checkout of working tree after initial import

When creating a brand new git repository through git-cvsimport (not
incremental import), force a checkout of HEAD of master as working tree
after successful import using the -f switch to git checkout.  Otherwise
the working tree is empty, and all files are reported as 'deleted' by
git status.

This was noticed and reported by Cameron Dale through
 http://bugs.debian.org/430903

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoAdd test-script for git-tag
Carlos Rica [Thu, 28 Jun 2007 20:09:12 +0000 (22:09 +0200)] 
Add test-script for git-tag

These tests are useful to develop the C version for git-tag.sh,
ensuring that the future builtin-tag.c will not break previous
behaviour.

The tests are focused on listing, verifying, deleting and creating
tags, checking always that the correct status value is returned
and everything remains as expected.

In order to verify and create signed tags, a PGP key was also
added, being created this way: gpg --homedir t/t7004 --gen-key
Type DSA and Elgamal, size 2048 bits, no expiration date.
Name and email: C O Mitter <committer@example.com>
No password given, to enable non-interactive operation.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-log: detect dup and fdopen failure
Jim Meyering [Wed, 27 Jun 2007 14:28:53 +0000 (16:28 +0200)] 
git-log: detect dup and fdopen failure

This defines xdup() and xfdopen() in git-compat-util.h to give
us error-catching variants of them without cluttering the code
too much.

Signed-off-by: Jim Meyering <jim@meyering.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-send-email: make options easier to configure.
Adam Roben [Thu, 28 Jun 2007 03:59:37 +0000 (20:59 -0700)] 
git-send-email: make options easier to configure.

This change makes git-send-email's behavior easier to modify by adding config
equivalents for two more of git-send-email's flags.

The mapping of flag to config setting is:
  --[no-]supress-from => sendemail.suppressfrom
  --[no-]signed-off-cc => sendemail.signedoffcc

It renames the --threaded option to --thread/--no-thread; the
config variable is also called sendemail.thread.

Signed-off-by: Adam Roben <aroben@apple.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/gitk/gitk
Junio C Hamano [Thu, 28 Jun 2007 03:48:17 +0000 (20:48 -0700)] 
Merge branch 'master' of git://git./gitk/gitk

* 'master' of git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Update selection background colorbar in prefs dialog
  gitk: Use a spinbox for setting tabstop settings

17 years agogitk: Update selection background colorbar in prefs dialog
Mark Levedahl [Wed, 27 Jun 2007 01:51:34 +0000 (21:51 -0400)] 
gitk: Update selection background colorbar in prefs dialog

The callback function was incorrectly set to update the background
colorbar when updated the selection background. This did not affect the
colors chosen or their use, just their presentation in the preferences
dialog box.

Signed-off-by: Mark Levedahl <mdl123@verizon.net>
17 years agogitk: Use a spinbox for setting tabstop settings
Mark Levedahl [Wed, 27 Jun 2007 01:51:35 +0000 (21:51 -0400)] 
gitk: Use a spinbox for setting tabstop settings

The tabstop must be a smallish positive integer, and a spinbox is the
accepted UI control to accomplish this limiting rather than the text
entry box previously used.

Signed-off-by: Mark Levedahl <mdl123@verizon.net>
17 years agoAdd test script for git-stripspace.
Carlos Rica [Mon, 25 Jun 2007 19:24:21 +0000 (21:24 +0200)] 
Add test script for git-stripspace.

These tests check some features that git-stripspace already has
and those that it should manage well: Removing trailing spaces
from lines, removing blank lines at the beginning and end,
unifying multiple lines between paragraphs, doing the correct
when there is no newline at the last line, etc.

It seems that the implementation needs to save the whole line
in memory to be able to manage correctly long lines with
text and spaces conveniently distribuited on them.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoconfig: add support for --bool and --int while setting values
Frank Lichtenheld [Mon, 25 Jun 2007 14:00:24 +0000 (16:00 +0200)] 
config: add support for --bool and --int while setting values

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge branch 'master' of git://repo.or.cz/git/fastimport
Junio C Hamano [Wed, 27 Jun 2007 05:23:29 +0000 (22:23 -0700)] 
Merge branch 'master' of git://repo.or.cz/git/fastimport

* 'master' of git://repo.or.cz/git/fastimport:
  Teach bash how to complete +refspec on git-push

17 years agogit-send-email: Add --threaded option
Adam Roben [Tue, 26 Jun 2007 22:48:30 +0000 (15:48 -0700)] 
git-send-email: Add --threaded option

The --threaded option controls whether the In-Reply-To header will be set on
any emails sent. The current behavior is to always set this header, so this
option is most useful in its negated form, --no-threaded. This behavior can
also be controlled through the 'sendemail.threaded' config setting.

Signed-off-by: Adam Roben <aroben@apple.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoFix git-stripspace to process correctly long lines and spaces.
Carlos Rica [Mon, 25 Jun 2007 19:28:01 +0000 (21:28 +0200)] 
Fix git-stripspace to process correctly long lines and spaces.

Now the implementation gets more memory to store completely
each line before removing trailing spaces, and does it right
when the last line of the file ends with spaces and no newline
at the end.

Function stripspace needs again to be non-static in order to call
it from "builtin-tag.c" and the upcoming "builtin-commit.c".
A new parameter skip_comments was also added to the stripspace
function to optionally strips every shell #comment from the input,
needed for doing this task on those programs.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoDon't ignore a pack-refs write failure
Jim Meyering [Sun, 24 Jun 2007 19:13:11 +0000 (21:13 +0200)] 
Don't ignore a pack-refs write failure

Without this, if the size of refs_file at that point is ever an exact
multiple of BUFSIZ, then an EIO or ENOSPC error on the final write would
not be diagnosed.

It's not worth worrying about EPIPE here.
Although theoretically possible that someone kill this process
with a manual SIGPIPE, it's not at all likely.

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agodetect close failure on just-written file handles
Jim Meyering [Sun, 24 Jun 2007 19:20:41 +0000 (21:20 +0200)] 
detect close failure on just-written file handles

I audited git for potential undetected write failures.
In the cases fixed below, the diagnostics I add mimic the diagnostics
used in surrounding code, even when that means not reporting
the precise strerror(errno) cause of the error.

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge branch 'maint'
Shawn O. Pearce [Wed, 27 Jun 2007 04:36:38 +0000 (00:36 -0400)] 
Merge branch 'maint'

* maint:
  git-gui: Don't require a .pvcsrc to create Tools/Migrate menu hack
  git-gui: Don't nice git blame on MSYS as nice is not supported
  git-gui: Don't require $DISPLAY just to get --version

17 years agogit-gui: Don't require a .pvcsrc to create Tools/Migrate menu hack gitgui-0.7.4
Shawn O. Pearce [Tue, 26 Jun 2007 19:27:35 +0000 (15:27 -0400)] 
git-gui: Don't require a .pvcsrc to create Tools/Migrate menu hack

The Tools/Migrate menu option is a hack just for me.  Yes, that's
right, git-gui has a hidden feature that really only works for me,
and the users that I support within my day-job's great firewall.
The menu option is not supported outside of that environment.

In the past we only enabled Tools/Migrate if our special local
script 'gui-miga' existed in the proper location, and if there
was a special '.pvcsrc' in the top level of the working directory.
This latter test for the '.pvcsrc' file is now failing, as the file
was removed from all Git repositories due to changes made to other
tooling within the great firewall's realm.

I have changed the test to only work on Cygwin, and only if the
special 'gui-miga' is present.  This works around the configuration
changes made recently within the great firewall's realm, but really
this entire Tools/Migrate thing should be abstracted out into some
sort of plugin system so other users can extend git-gui as they need.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-gui: Don't nice git blame on MSYS as nice is not supported
Shawn O. Pearce [Wed, 27 Jun 2007 04:27:13 +0000 (00:27 -0400)] 
git-gui: Don't nice git blame on MSYS as nice is not supported

Johannes Sixt reported that MinGW/MSYS does not have a nice.exe to
drop the priority of a child process when it gets spawned.  So we
have to avoid trying to start `git blame` through nice when we are
on Windows and do not have Cygwin available to us.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoconfig: Add --null/-z option for null-delimted output
Frank Lichtenheld [Mon, 25 Jun 2007 14:03:55 +0000 (16:03 +0200)] 
config: Add --null/-z option for null-delimted output

Use \n as delimiter between key and value and \0 as
delimiter after each key/value pair. This should be
easily parsable output.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoTeach rebase -i about --preserve-merges
Johannes Schindelin [Mon, 25 Jun 2007 17:59:43 +0000 (18:59 +0100)] 
Teach rebase -i about --preserve-merges

The option "-p" (or long "--preserve-merges") makes it possible to
rebase side branches including merges, without straightening the
history.

Example:

           X
            \
         A---M---B
        /
---o---O---P---Q

When the current HEAD is "B", "git rebase -i -p --onto Q O" will yield

               X
                 \
---o---O---P---Q---A'---M'---B'

Note that this will

- _not_ touch X [*1*], it does

- _not_ work without the --interactive flag [*2*], it does

- _not_ guess the type of the merge, but blindly uses recursive or
  whatever strategy you provided with "-s <strategy>" for all merges it
  has to redo, and it does

- _not_ make use of the original merge commit via git-rerere.

*1*: only commits which reach a merge base between <upstream> and HEAD
     are reapplied. The others are kept as-are.

*2*: git-rebase without --interactive is inherently patch based (at
     least at the moment), and therefore merges cannot be preserved.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agorebase -i: provide reasonable reflog for the rebased branch
Johannes Schindelin [Mon, 25 Jun 2007 17:58:28 +0000 (18:58 +0100)] 
rebase -i: provide reasonable reflog for the rebased branch

If your rebase succeeded, the HEAD's reflog will still show the whole
mess, but "<branchname>@{1}" now shows the state _before_ the rebase,
so that you can reset (or compare) the original and the rebased
revisions more easily.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agorebase -i: several cleanups
Johannes Schindelin [Mon, 25 Jun 2007 17:56:55 +0000 (18:56 +0100)] 
rebase -i: several cleanups

Support "--verbose" in addition to "-v", show short names in the list
comment, clean up if there is nothing to do, and add several "test_ticks"
in the test script.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge branch 'maint'
Junio C Hamano [Wed, 27 Jun 2007 01:33:24 +0000 (18:33 -0700)] 
Merge branch 'maint'

* maint:
  config: Change output of --get-regexp for valueless keys
  config: Complete documentation of --get-regexp
  cleanup merge-base test script
  Fix zero-object version-2 packs
  Ignore submodule commits when fetching over dumb protocols

17 years agoconfig: Change output of --get-regexp for valueless keys
Frank Lichtenheld [Mon, 25 Jun 2007 14:03:54 +0000 (16:03 +0200)] 
config: Change output of --get-regexp for valueless keys

Print no space after the name of a key without value.
Otherwise keys without values are printed exactly the
same as keys with empty values.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoconfig: Complete documentation of --get-regexp
Frank Lichtenheld [Mon, 25 Jun 2007 14:03:53 +0000 (16:03 +0200)] 
config: Complete documentation of --get-regexp

The asciidoc documentation of the --get-regexp option was
incomplete. Add some missing pieces:
 - List the option in SYNOPSIS
 - Mention that key names are printed

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-new-workdir: Fix shell warning about operator == used with test.
Simon Hausmann [Mon, 25 Jun 2007 11:04:26 +0000 (13:04 +0200)] 
git-new-workdir: Fix shell warning about operator == used with test.

Use = instead of == with test to test for equality.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agocleanup merge-base test script
Sam Vilain [Tue, 26 Jun 2007 23:44:22 +0000 (11:44 +1200)] 
cleanup merge-base test script

Add a picture, and keep the setup and the tests together.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit.spec: RPM failed, looking for wrong files.
Quy Tonthat [Tue, 26 Jun 2007 15:39:07 +0000 (01:39 +1000)] 
git.spec: RPM failed, looking for wrong files.

RPM build broke with "File not found" error on git-gui.1 and git-citool.1
They actually are git-gui.1.gz and git-citool.1.gz

Signed-off-by: Quy Tonthat <qtonthat@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoFix zero-object version-2 packs
Linus Torvalds [Tue, 26 Jun 2007 21:34:02 +0000 (14:34 -0700)] 
Fix zero-object version-2 packs

A pack-file can get created without any objects in it (to transfer "no
data" - which can happen if you use a reference git repo, for example,
or just otherwise just end up transferring only branch head information
and already have all the objects themselves).

And while we probably should never create an index for such a pack, if we
do (and we do), the index file size sanity checking was incorrect.

This fixes it.

Reported-and-tested-by: Jocke Tjernlund <tjernlund@tjernlund.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoIgnore submodule commits when fetching over dumb protocols
Sven Verdoolaege [Tue, 26 Jun 2007 21:19:41 +0000 (23:19 +0200)] 
Ignore submodule commits when fetching over dumb protocols

Without this patch, the code would look for the submodule
commits in the superproject and (needlessly) fail when it
couldn't find them.

Signed-off-by: Sven Verdoolaege <skimo@liacs.nl>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoignore git-rebase--interactive
Matthias Lederhofer [Tue, 26 Jun 2007 13:38:42 +0000 (15:38 +0200)] 
ignore git-rebase--interactive

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/gitk/gitk into pm/gitk
Junio C Hamano [Tue, 26 Jun 2007 22:41:06 +0000 (15:41 -0700)] 
Merge branch 'master' of git://git./gitk/gitk into pm/gitk

* 'master' of git://git.kernel.org/pub/scm/gitk/gitk: (21 commits)
  gitk: Add a progress bar to show progress while resetting
  gitk: Improve handling of whitespace and special chars in filenames
  gitk: Fix bug causing nearby tags/heads to sometimes not be displayed
  gitk: Limit how often we change the canvas scrolling region
  gitk: Add a "reset branch to here" row context-menu operation
  gitk: Get rid of the childlist variable
  gitk: Speed up the reading of references
  gitk: Show local uncommitted changes as a fake commit
  gitk: New algorithm for drawing the graph lines
  gitk: Store ids in rowrangelist and idrowranges rather than row numbers
  gitk: Disable the head context menu entries for the checked-out branch
  gitk: Cope with commit messages with carriage-returns and initial blank lines
  gitk: Implement a simple scheduler for the compute-intensive stuff
  gitk: Improve the behaviour of the initial selection
  gitk: Add some more comments to the optimize_rows procedure
  gitk: Don't try to list large numbers of tags or heads in the details pane
  gitk: New infrastructure for working out branches & previous/next tags
  [PATCH] gitk: Allow specifying tabstop as other than default 8 characters.
  [PATCH] gitk: Update fontsize in patch / tree list
  [PATCH] gitk: Make selection highlight color configurable
  ...

Conflicts:

gitk

17 years agogitk: Add a progress bar to show progress while resetting
Paul Mackerras [Tue, 26 Jun 2007 01:09:49 +0000 (11:09 +1000)] 
gitk: Add a progress bar to show progress while resetting

Since git reset now gets chatty while resetting, we were getting errors
reported when a reset was done using the "reset branch to here" menu
item.  With this we now read the progress messages from git reset and
update a progress bar.  Because git reset outputs the progress messages
to standard error, and Tcl treats messages to standard error as error
messages, we have to invoke git reset via a shell and redirect standard
error into standard output.

This also fixes a bug in computing descendent heads when head ids
are changed via a reset.

Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years agodiff: round down similarity index
René Scharfe [Sun, 24 Jun 2007 22:23:34 +0000 (00:23 +0200)] 
diff: round down similarity index

Rounding down the printed (dis)similarity index allows us to use
"100%" as a special value that indicates complete rewrites and
fully equal file contents, respectively.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agodiffcore-rename: don't change similarity index based on basename equality
René Scharfe [Sun, 24 Jun 2007 22:23:28 +0000 (00:23 +0200)] 
diffcore-rename: don't change similarity index based on basename equality

This implements a suggestion from Johannes.  It uses a separate field in
struct diff_score to keep the result of the file name comparison in the
rename detection logic.  This reverts the value of the similarity index
to be a function of file contents, only, and basename comparison is only
used to decide between files with equal amounts of content changes.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoCheck for IO errors after running a command
Linus Torvalds [Sun, 24 Jun 2007 17:29:33 +0000 (10:29 -0700)] 
Check for IO errors after running a command

This is trying to implement the strict IO error checks that Jim Meyering
suggested, but explicitly limits it to just regular files. If a pipe gets
closed on us, we shouldn't complain about it.

If the subcommand already returned an error, that takes precedence (and we
assume that the subcommand already printed out any relevant messages
relating to it)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoClean up internal command handling
Linus Torvalds [Sun, 24 Jun 2007 17:10:40 +0000 (10:10 -0700)] 
Clean up internal command handling

This should change no code at all, it just moves the definition of "struct
cmd_struct" out, and then splits out the running of the right command into
the "run_command()" function.

It also removes the long-unused 'envp' pointer passing.

This is just preparation for adding some more error checking.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoTeach rebase an interactive mode
Johannes Schindelin [Mon, 25 Jun 2007 00:11:14 +0000 (01:11 +0100)] 
Teach rebase an interactive mode

Don't you just hate the fact sometimes, that git-rebase just applies
the patches, without any possibility to edit them, or rearrange them?
With "--interactive", git-rebase now lets you edit the list of patches,
so that you can reorder, edit and delete patches.

Such a list will typically look like this:

pick deadbee The oneline of this commit
pick fa1afe1 The oneline of the next commit
...

By replacing the command "pick" with the command "edit", you can amend
that patch and/or its commit message, and by replacing it with "squash"
you can tell rebase to fold that patch into the patch before that.

It is derived from the script sent to the list in
<Pine.LNX.4.63.0702252156190.22628@wbgn013.biozentrum.uni-wuerzburg.de>

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMove the pick_author code to git-sh-setup
Johannes Schindelin [Mon, 25 Jun 2007 00:04:11 +0000 (01:04 +0100)] 
Move the pick_author code to git-sh-setup

At the moment, only git-commit uses that code, to pick the author name,
email and date from a given commit.

This code will be reused in git rebase --interactive.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoTeach bash how to complete +refspec on git-push
Shawn O. Pearce [Sun, 24 Jun 2007 23:42:16 +0000 (19:42 -0400)] 
Teach bash how to complete +refspec on git-push

Using `git push origin +foo` to forcefully overwrite the remote
branch named foo is a common idiom, especially since + is shorter
than the long option --force and can be specified on a per-branch
basis.

We now complete `git push origin +foo` just like we do the standard
`git push origin foo`.  The leading + on a branch refspec does not
alter the completion.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoAdd core.quotepath configuration variable.
Junio C Hamano [Sun, 24 Jun 2007 22:11:24 +0000 (15:11 -0700)] 
Add core.quotepath configuration variable.

We always quote "unusual" byte values in a pathname using
C-string style, to make it safer for parsing scripts that do not
handle NUL separated records well (or just too lazy to bother).
The absolute minimum bytes that need to be quoted for this
purpose are TAB, LF (and other control characters), double quote
and backslash.

However, we have also always quoted the bytes in high 8-bit
range; this was partly because we were lazy and partly because
we were being cautious.

This introduces an internal "quote_path_fully" variable, and
core.quotepath configuration variable to control it.  When set
to false, it does not quote bytes in high 8-bit range anymore
but passes them intact.

The variable defaults to "true" to retain the traditional
behaviour for now.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-send-email: Do not make @-less message ID
Junio C Hamano [Wed, 20 Jun 2007 20:47:34 +0000 (13:47 -0700)] 
git-send-email: Do not make @-less message ID

When the original $from address fails to yield a valid-looking
e-mail address, we created a bogus looking message ID, formatted
like this:

Message-Id: <11823357623688-git-send-email->

This commit fixes it by moving call to make_message_id() to
where it matters, namely, before the $message_id is needed to be
placed in the generated e-mail header; this has an important
side effect of making it clear that $from is already available.

Also throw in Sys::Hostname::hostname() just for fun, although I
suspect that the code would never trigger due to the modified
call sequence that makes sure $from is always available.  This
is based on a suggestion by Michael Hendricks.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-svn: trailing slash in prefix is mandatory with --branches/-b
Gerrit Pape [Tue, 19 Jun 2007 16:47:41 +0000 (16:47 +0000)] 
git-svn: trailing slash in prefix is mandatory with --branches/-b

Make clear in the documentation that when using --branches/-b and
--prefix with 'init', the prefix must include a trailing slash.
This matches the actual behavior of git-svn, e.g.:

 $ git svn init -Ttrunk -treleases -bbranches --prefix xxx \
     http://svn.sacredchao.net/svn/quodlibet/
 --prefix='xxx' must have a trailing slash '/'
 $

This was noticed by R. Vanicat and reported through
 http://bugs.debian.org/429443

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agonew-workdir: handle rev-parse --git-dir not always giving full path
Julian Phillips [Tue, 19 Jun 2007 11:44:43 +0000 (12:44 +0100)] 
new-workdir: handle rev-parse --git-dir not always giving full path

rev-parse --git-dir outputs a full path - except for the single case
of when the path would be $(pwd)/.git, in which case it outputs simply
.git.  Check for this special case and handle it.

Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agomake dist: include configure script in tarball
Matthias Lederhofer [Mon, 18 Jun 2007 21:30:36 +0000 (23:30 +0200)] 
make dist: include configure script in tarball

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge branch 'lt/follow'
Junio C Hamano [Sun, 24 Jun 2007 09:08:31 +0000 (02:08 -0700)] 
Merge branch 'lt/follow'

* lt/follow:
  Fix up "git log --follow" a bit..
  Finally implement "git log --follow"

17 years agot9500: skip gitweb tests if perl version is too old
Sven Verdoolaege [Fri, 22 Jun 2007 15:49:08 +0000 (17:49 +0200)] 
t9500: skip gitweb tests if perl version is too old

gitweb calls Encode::decode_utf8 with two arguments,
but old versions of perl only allow this function to be called
with one argument.  Even older versions of perl do not even
have an Encode module.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge branch 'master' of git://repo.or.cz/git/fastimport
Junio C Hamano [Sun, 24 Jun 2007 06:54:41 +0000 (23:54 -0700)] 
Merge branch 'master' of git://repo.or.cz/git/fastimport

* 'master' of git://repo.or.cz/git/fastimport: (260 commits)
  Avoid src:dst syntax as default bash completion for git push
  Make it possible to specify the HEAD for the internal findUpstreamBranchPoint function.
  Added git-p4 branches command that shows the mapping of perforce depot paths to imported git branches.
  Warn about conflicting p4 branch mappings and use the first one found.
  Fix the branch mapping detection to be independent from the order of the "p4 branches" output.
  git-p4 fails when cloning a p4 depo.
  Fix initial multi-branch import.
  Only use double quotes on Windows
  Fix git-p4 rebase to detect the correct upstream branch instead of unconditionally
  Moved the code from git-p4 submit to figure out the upstream branch point
  git-p4 submit: Fix missing quotes around p4 commands to make them work with spaces in filenames
  Mention remotes/p4/master also in the documentation.
  Provide some information for single branch imports where the commits go
  git-p4: check for existence of repo dir before trying to create
  Write out the options tag in the log message of imports only if we actually have
  Fix support for explicit disabling of syncing with the origin
  Fix depot-paths encoding for multi-path imports (don't split up //depot/path/foo)
  Fix project name guessing
  Fix updating/creating remotes/p4/* heads from origin/p4/*
  Fixed the check to make sure to exclude the HEAD symbolic refs when updating
  ...

17 years agogitk: Improve handling of whitespace and special chars in filenames
Paul Mackerras [Sat, 23 Jun 2007 10:28:15 +0000 (20:28 +1000)] 
gitk: Improve handling of whitespace and special chars in filenames

The main thing here is better parsing of the diff --git lines in the
output of git diff-tree -p.  We now cope with filenames in quotes with
special chars escaped.  If the filenames contain spaces they aren't
quoted, however, which can create difficulties in parsing.  We get
around the difficulties by detecting the case when the filename hasn't
changed (chop the part after "diff --git " in two and see if the halves
match apart from a/ in one and b/ in the other), and if it hasn't
changed, we just use one half.  If the filename has changed we wait
for the "rename from" and "rename to" lines, which give the old and
new filenames unambiguously.

This also improves the parsing of the output of git diff-tree.
Instead of using lindex to extract the filename, we take the part from
the first tab on, and if it starts with a quote, we use [lindex $str 0]
to remove the quotes and convert the escapes.

This also gets rid of some unused tagging of the diff text, uses
[string compare] instead of [regexp] in some places, and fixes the
regexp for detecting the @@ hunk-separator lines (the regexp wasn't
accepting a single number, as in "-0,0 +1" for example).

Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years agogitk: Fix bug causing nearby tags/heads to sometimes not be displayed
Paul Mackerras [Mon, 18 Jun 2007 12:39:21 +0000 (22:39 +1000)] 
gitk: Fix bug causing nearby tags/heads to sometimes not be displayed

When we compute descendent heads and descendent/ancestor tags, we
cache the results.  We need to be careful to invalidate the cache
when we add stuff to the graph.  Also make sure that when we cache
descendent heads for a node we only cache the heads that are actually
descendents of that node.

Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years agogitk: Limit how often we change the canvas scrolling region
Paul Mackerras [Tue, 31 Oct 2006 04:00:53 +0000 (15:00 +1100)] 
gitk: Limit how often we change the canvas scrolling region

For some unknown reason, changing the scrolling region on the canvases
provokes multiple milliseconds worth of computation in the X server,
and this can end up slowing gitk down significantly.  This works around
the problem by limiting the rate at which we update the scrolling region
after the first 100 rows to at most 2 per second.

Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years agogitk: Add a "reset branch to here" row context-menu operation
Paul Mackerras [Thu, 19 Oct 2006 00:09:06 +0000 (10:09 +1000)] 
gitk: Add a "reset branch to here" row context-menu operation

This adds an entry to the menu that comes up when the user does a
right-click on a row.  The new entry allows the user to reset the
currently checked-out head to the commit for the row that they did
the right-click on.  The user has to select what type of reset to
do, and confirm the reset, via a dialog box that pops up.

Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years agogitk: Get rid of the childlist variable
Paul Mackerras [Sun, 17 Jun 2007 23:48:23 +0000 (09:48 +1000)] 
gitk: Get rid of the childlist variable

The information in childlist is a duplicate of what's in the children
array, and it wasn't being accessed often enough to be really worth
keeping the list around as well.

Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years agogitk: Speed up the reading of references
Paul Mackerras [Mon, 11 Sep 2006 00:36:53 +0000 (10:36 +1000)] 
gitk: Speed up the reading of references

We were doing two execs for each tag - one to map the tag ID to a
commit ID and one to read the contents of the tag for later display.
This speeds up the process by not reading the contents of the tag
(instead it is read later if needed), and by using the -d flag to
git show-ref, which gives us refs/tags/foo^{} lines which give us
the commit ID.  Also this uses string operations instead of regexps.

Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years agogitk: Show local uncommitted changes as a fake commit
Paul Mackerras [Thu, 7 Sep 2006 00:21:39 +0000 (10:21 +1000)] 
gitk: Show local uncommitted changes as a fake commit

If there are local changes in the repository, i.e., git-diff-index HEAD
produces some output, then this optionally displays an extra row in
the graph as a child of the HEAD commit (but with a red circle to
indicate that it's not a real commit).  There is a checkbox in the
preferences window to control whether gitk does this or not.

Clicking on the extra row shows the diffs between the working directory
and the HEAD (using git diff-index -p).  The right-click menu on the
extra row allows the user to generate a patch containing the local diffs,
or to display the diffs between the working directory and any commit.

Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years agogitk: New algorithm for drawing the graph lines
Paul Mackerras [Sun, 15 Oct 2006 08:03:46 +0000 (18:03 +1000)] 
gitk: New algorithm for drawing the graph lines

This only draws as much of the graph lines as is visible.  This can
happen by adding coordinates on to an existing graph line or by
creating a new line.  This means that we only need to have laid out
and optimized as much of the graph as is actually visible in order to
draw it, including the lines (previously we didn't draw a graph
line until we had laid out and optimized to the end of a segment of
the line, i.e. down to a down-arrow or to the row where the line's
commit is displayed).  This also lets us get rid of the linesegends
list, and gives us an easy workaround for the X server bug that
causes long lines to be misdrawn.  This also gets rid of the use
of rowoffsets in drawlineseg et al.

Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years agogitk: Store ids in rowrangelist and idrowranges rather than row numbers
Paul Mackerras [Sat, 14 Oct 2006 09:21:02 +0000 (19:21 +1000)] 
gitk: Store ids in rowrangelist and idrowranges rather than row numbers

This removes the need for insertrow to go through rowrangelist and
idrowranges and adjust a lot of entries.  The first entry for a given
id is now the row number of the first child, not that row number + 1,
and rowranges compensates for that so its callers didn't have to
change.  This adds a ranges argument to drawlineseg so that we can
avoid calling rowranges a second time inside drawlineseg (all its
callers already called rowranges).

Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years agogitk: Disable the head context menu entries for the checked-out branch
Paul Mackerras [Sun, 17 Jun 2007 07:08:35 +0000 (17:08 +1000)] 
gitk: Disable the head context menu entries for the checked-out branch

Neither the "check out this branch" nor the "remove this branch"
menu item can be used on the currently-checked out branch, so disable
them.

Signed-off-by: Paul Mackerras <paulus@samba.org>