Commit Graph

11231 Commits

Author SHA1 Message Date
Shawn O. Pearce
401d53fa35 Teach fast-import to ignore lines starting with '#'
Several frontend developers have asked that some form of stream
comments be permitted within a fast-import data stream.  This way
they can include information from their own frontend program about
where specific data was taken from in the source system, or about
a decision that their frontend may have made while creating the
fast-import data stream.

This change introduces comments in the Bourne-shell/Tcl/Perl style.
Lines starting with '#' are ignored, up to and including the LF.
Unlike the above mentioned three languages however we do not look for
and ignore leading whitespace.  This just simplifies the definition
of the comment format and the code that parses them.

To make comments work we had to stop using read_next_command() within
cmd_data() and directly invoke read_line() during the inline variant
of the function.  This is necessary to retain any lines of the
input data that might otherwise look like a comment to fast-import.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-19 03:38:35 -04:00
Shawn O. Pearce
3149007475 Use handy ALLOC_GROW macro in fast-import when possible
Instead of growing our buffer by hand during the inline variant of
cmd_data() we can save a few lines of code and just use the nifty
new ALLOC_GROW macro already available to us.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-19 03:38:34 -04:00
Shawn O. Pearce
ea08a6fd19 Actually allow TAG_FIXUP branches in fast-import
Michael Haggerty <mhagger@alum.mit.edu> noticed while debugging a
Git backend for cvs2svn that fast-import was barfing when he tried
to use "TAG_FIXUP" as a branch name for temporary work needed to
cleanup the tree prior to creating an annotated tag object.

The reason we were rejecting the branch name was check_ref_format()
returns -2 when there are less than 2 '/' characters in the input
name.  TAG_FIXUP has 0 '/' characters, but is technically just as
valid of a ref as HEAD and MERGE_HEAD, so we really should permit it
(and any other similar looking name) during import.

New test cases have been added to make sure we still detect very
wrong branch names (e.g. containing [ or starting with .) and yet
still permit reasonable names (e.g. TAG_FIXUP).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-19 03:38:34 -04:00
Alex Riesen
c905e09006 Fix whitespace in "Format of STDIN stream" of fast-import
Something probably assumed that HT indentation is 4 characters.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-19 03:38:34 -04:00
Mark Levedahl
374a58c9fb git-completion.bash - add support for git-bundle
Signed-off-by: Mark Levedahl <mdl123@verizon.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-19 03:38:33 -04:00
Mike Hommey
0734d2656a Clarify commit-tree documentation
As per http://marc.info/?l=git&m=118737219702802&w=2 , clarify
git-commit-tree documentation.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-17 16:51:15 -07:00
Brian Gernhardt
5876b8ee3c Minor clarifications to git-filter-branch usage and doc
- Remove "DESTBRANCH" from usage, as it rewrites the branches given.
- Remove an = from an example usage, as the script doesn't understand
it.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-17 16:32:57 -07:00
Sean Estabrooks
e63b58ba0b Fix small typo in git send-email man page.
Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-17 15:20:35 -07:00
Lars Hjemli
97a5d8cce9 git-submodule: re-enable 'status' as the default subcommand
This was broken as part of ecda072380.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Acked-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-17 02:44:09 -07:00
Junio C Hamano
a9ab2009db Clean-up read-tree error condition.
This is a follow-up to f34f2b0b; list_tree() function is where it
first notices that the command line fed too many trees for us to
handle, so move the error exit message to there, and raise the
MAX_TREES to 8 (not that it matters very much in practice).

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-16 21:19:06 -07:00
Brian Downing
d1d028ea16 Clarify actual behavior of 'git add' and ignored files
Signed-off-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-16 16:44:19 -07:00
Arjen Laarhoven
19b28bf545 t1301-shared-repo.sh: fix 'stat' portability issue
The t1301-shared-repo.sh testscript uses /usr/bin/stat to get the file
mode, which isn't portable.  Implement the test in shell using 'ls' as
shown by Junio.

Signed-off-by: Arjen Laarhoven <arjen@yaph.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-16 15:32:46 -07:00
Junio C Hamano
13cc4c81df Documentation/git-rebase: fix an example
The example miscounted the commit to rebase from.
Noticed by Cliff Brake.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-16 12:20:25 -07:00
Junio C Hamano
312efe9b58 git-clone: allow --bare clone
This is a stop-gap to work around problem with git-init without
intrusive changes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-15 21:39:07 -07:00
Nicolas Pitre
d250626cbb pack-objects: remove bogus arguments to delta_cacheable()
Not only are they unused, but the order in the function declaration
and the actual usage don't match.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-15 21:39:07 -07:00
Sven Verdoolaege
e06c5a6c7b git-apply: apply submodule changes
Apply "Subproject commit HEX" changes produced by git-diff.
As usual in the current git, only the superproject itself is actually
modified (possibly creating empty directories for new submodules).
Any checked-out submodule is left untouched and is not required to
be up-to-date.

With clean-ups from Junio C Hamano.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-15 21:39:07 -07:00
Junio C Hamano
da899deb24 Update documentation links for older releases.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-15 21:39:07 -07:00
Junio C Hamano
c576304d51 Merge branch 'maint' to sync with 1.5.2.5
* maint:
  GIT 1.5.2.5
  git-add -u paths... now works from subdirectory
  Fix "git add -u" data corruption.
2007-08-15 21:38:38 -07:00
Junio C Hamano
f34f2b0b38 Fix read-tree merging more than 3 trees using 3-way merge
For multi-base merges, we allowed read-tree -m to take more than
three trees (the last two are our and their branches, and all the
earlier ones, typically one but potentially more, are used as the
merge base).  Unfortunately, the conversion done by commit 933bf40
broke this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-15 21:36:37 -07:00
Junio C Hamano
b13ef4916a GIT 1.5.2.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-15 15:01:20 -07:00
Salikh Zakirov
2ed2c222df git-add -u paths... now works from subdirectory
git-add -u also takes the path limiters, but unlike the
command without the -u option, the code forgot that it
could be invoked from a subdirectory, and did not correctly
handle the prefix.

Signed-off-by: Salikh Zakirov <salikh@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-15 14:28:34 -07:00
Junio C Hamano
a4882c27f8 Fix "git add -u" data corruption.
This applies to 'maint' to fix a rather serious data corruption
issue.  When "git add -u" affects a subdirectory in such a way
that the only changes to its contents are path removals, the
next tree object written out of that index was bogus, as the
remove codepath forgot to invalidate the cache-tree entry.

Reported by Salikh Zakirov.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-15 14:21:23 -07:00
René Scharfe
79d722224d path-list.c: always free strdup'ed paths
Always free .paths if .strdup_paths is set, no matter if the
parameter free_items is set or not, plugging a minor memory leak.
And to clarify the meaning of the flag, rename it to free_util,
since it now only affects the freeing of the .util field.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-15 13:43:08 -07:00
Eric Wong
6ed77266c6 git-svn: fix log with single revision against a non-HEAD branch
Running git-svn log <ref> -r<rev> against a <ref> other than the
current HEAD did not work if the <rev> was exclusive to the
other branch.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-15 12:09:48 -07:00
Junio C Hamano
1467b5fec3 GIT 1.5.3-rc5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-15 00:01:57 -07:00
Junio C Hamano
1a9d7e9b48 attr.c: read .gitattributes from index as well.
This makes .gitattributes files to be read from the index when
they are not checked out to the work tree.  This is in line with
the way we always allowed low-level tools to operate in sparsely
checked out work tree in a reasonable way.

It swaps the order of new file creation and converting the blob
to work tree representation; otherwise when we are in the middle
of checking out .gitattributes we would notice an empty but
unwritten .gitattributes file in the work tree and will ignore
the copy in the index.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-14 23:19:10 -07:00
Junio C Hamano
a44131181a attr.c: refactoring
This splits out a common routine that parses a single line of
attribute file and adds it to the attr_stack.  It should not
change any behaviour, other than attrs array in the attr_stack
structure is now grown with alloc_nr() macro, instead of one by
one, which relied on xrealloc() to give enough slack to be
efficient enough.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-14 23:19:06 -07:00
Brian Downing
6b06d518ca Add read_cache to builtin-check-attr
We can now read .gitattributes files out of the index, but the index
must be loaded for this to work.

Signed-off-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-14 22:46:01 -07:00
René Scharfe
6d2d9e8666 diff: squelch empty diffs even more
When we compare two non-tracked files, or explicitly
specify --no-index, the suggestion to run git-status
is not helpful.

The patch adds a new diff_options bitfield member, no_index, that
is used instead of the special value of -2 of the rev_info field
max_count to indicate that the index is not to be used.  This makes
it possible to pass that flag down to diffcore_skip_stat_unmatch(),
which only has one diff_options parameter.

This could even become a cleanup if we removed all assignments of
max_count to a value of -2 (viz. replacement of a magic value with
a self-documenting field name) but I didn't dare to do that so late
in the rc game..

The no_index bit, if set, then tells diffcore_skip_stat_unmatch()
to not account for any skipped stat-mismatches, which avoids the
suggestion to run git-status.

Signed-off-by: Rene Scharfe <rene.scharfe@lsfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-14 22:34:58 -07:00
Luiz Fernando N. Capitulino
7647b17f1d Use xmkstemp() instead of mkstemp()
xmkstemp() performs error checking and prints a standard error message when
an error occur.

Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-14 22:20:26 -07:00
Luiz Fernando N. Capitulino
f21a47b27c Introduces xmkstemp()
This is a wrapper for mkstemp() that performs error checking and
calls die() when an error occur.

Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-14 22:20:23 -07:00
Luiz Fernando N. Capitulino
eef427a09c Avoid ambiguous error message if pack.idx header is wrong
Print the index version when an error occurs so the user
knows what type of header (and size) we thought the index
should have had.

Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-14 22:20:13 -07:00
Junio C Hamano
b798671fa9 merge-recursive: do not rudely die on binary merge
When you try to merge a path that involves binary file-level
merge, merge-recursive died rudely without cleaning up its own
mess.  A files added by the merge were left in the working tree,
but the index was not written out (because it just punted and
died), so it was cumbersome for the user to retry it by first
running "git reset --hard".

This changes merge-recursive to still warn but do the "binary"
merge for such a path; leave the "our" version in the working
tree, but still keep the path unmerged so that the user can sort
it out.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-14 22:20:01 -07:00
Marco Costalba
9fa3465d6b Add --log-size to git log to print message size
With this option git-log prints log message size
just before the corresponding message.

Porcelain tools could use this to speedup parsing
of git-log output.

Note that size refers to log message only. If also
patch content is shown its size is not included.

In case it is not possible to know the size upfront
size value is set to zero.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-14 01:59:33 -07:00
Junio C Hamano
fb13227e08 git-diff: squelch "empty" diffs
After starting to edit a working tree file but later when your edit ends
up identical to the original (this can also happen when you ran a
wholesale regexp replace with something like "perl -i" that does not
actually modify many of the paths), "git diff" between the index and the
working tree outputs many "empty" diffs that show "diff --git" headers
and nothing else, because these paths are stat-dirty.  While it was a
way to warn the user that the earlier action of the user made the index
ineffective as an optimization mechanism, it was felt too loud for the
purpose of warning even to experienced users, and also resulted in
confusing people new to git.

This replaces the "empty" diffs with a single warning message at the
end.  Having many such paths hurts performance, and you can run
"git-update-index --refresh" to update the lstat(2) information recorded
in the index in such a case.  "git-status" does so as a side effect, and
that is more familiar to the end-user, so we recommend it to them.

The change affects only "git diff" that outputs patch text, because that
is where the annoyance of too many "empty" diff is most strongly felt,
and because the warning message can be safely ignored by downstream
tools without getting mistaken as part of the patch.  For the low-level
"git diff-files" and "git diff-index", the traditional behaviour is
retained.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-14 01:55:00 -07:00
Steffen Prohaska
180787c48f Improved hint on how to set identity
The first thing we teach in the tutorial is to set the default
identity in $HOME/.gitconfig using "git config --global".  The
suggestion in the error message should match the order, while
hinting that per repository identity can later be configured
differently.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 23:34:38 -07:00
David Kastrup
30c5cd3124 Add a test for git-commit being confused by relative GIT_DIR
Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 21:19:48 -07:00
David Kastrup
b2bc9a3098 git-sh-setup.sh: make GIT_DIR absolute
Quite a few of the scripts are rather careless about using GIT_DIR
while changing directories.

Some try their hands (with different likelihood of success) in making
GIT_DIR absolute.

This patch lets git-sh-setup.sh cater for absolute directories (in a
way that should work reliably also with non-Unix path names) and
removes the respective kludges in git-filter-branch.sh and
git-instaweb.sh.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 21:19:48 -07:00
Alberto Bertogli
0476786e64 Allow git-svnimport to take "" as the trunk directory.
Some repositories started with the trunk in "/" and then moved it to the
standard "trunk/" location.

On these repositories, the correct thing would be to call git-svnimport -T "",
but because of the way the options are handled, it uses the default "trunk"
instead of the given empty string. This patch fixes that behaviour.

Reported by Leandro Lucarella <llucax@gmail.com>.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 21:19:20 -07:00
Brian Gernhardt
70f64148bf Fix t5701-clone-local for white space from wc
Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 16:47:38 -07:00
Reece H. Dunn
7da660f437 git-p4: Fix the sorting of changelists when cloning a Perforce repository.
When performing a git-p4 clone operation on a Perforce repository,
where the changelists change in order of magnitude (e.g. 100 to 1000),
the set of changes to import from is not sorted properly. This is
because the data in the list is strings not integers. The other place
where this is done already converts the value to an integer, so it is
not affected.

Acked-by: Simon Hausmann <simon@lst.de>
2007-08-13 15:23:14 -07:00
René Scharfe
89d07f750a diff: don't run pager if user asked for a diff style exit code
As Wincent Colaiuta found out, it's a bit unexpected for git diff to
start a pager even when the --quiet option is specified.  The problem
is that the pager hides the return code -- which is the only output
we're interested in in this case.

Push pager setup down into builtin-diff.c and don't start the pager
if --exit-code or --quiet (which implies --exit-code) was specified.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 13:06:23 -07:00
Junio C Hamano
4b37666ccb builtin-bundle create - use lock_file
"git bundle create" left an invalid, partially written bundle if
an error occured during creation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 13:04:18 -07:00
Mark Levedahl
95eb6853af t3902 - skip test if file system doesn't support HT in names
Windows / cygwin don't support HT, LF, or TAB in file name so this test
is meaningless there.

Signed-off-by: Mark Levedahl <mdl123@verizon.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 12:58:38 -07:00
Alexandre Julliard
d616813d75 git-add: Add support for --refresh option.
This allows to refresh only a subset of the project files, based on
the specified pathspecs.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 12:58:38 -07:00
Junio C Hamano
77b258f436 t3404: fix "fake-editor"
Here-text to create fake-editor did not use <<\EOF but <<EOF,
but there was no point doing so, as it quoted all the variables
anyway.  Simplify it.

Also futureproof the special mode to edit COMMIT_EDITMSG file;
it is interested in editing the COMMIT_EDITMSG file in any
GIT_DIR; GIT_DIR may be given as an absolute path.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 12:58:38 -07:00
Alexandre Julliard
8fdc39729b git.el: Always set the current directory in the git-diff buffer.
This allows jumping to the correct file with the diff-mode commands.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 12:58:38 -07:00
Alexandre Julliard
09afcd6933 git.el: Add support for interactive diffs.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 12:58:38 -07:00
Junio C Hamano
04d70bebe7 Merge branch 'master' of git://git.kernel.org/pub/scm/gitk/gitk
* 'master' of git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Fix bug causing Tcl error when updating graph
  gitk: Fix bug introduced in commit 67a4f1a7
  [PATCH] gitk: Show an error and exit if no .git could be found
  [PATCH] gitk: Continue and show error message in new repos
  [PATCH] gitk: Handle MouseWheel events on Windows
  [PATCH] gitk: Enable selected patch text on Windows
  gitk: Fix bug causing the "can't unset idinlist(...)" error
  gitk: Add a context menu for file list entries
2007-08-13 12:57:42 -07:00
Paul Mackerras
a69b2d1a8b gitk: Fix bug causing Tcl error when updating graph
If "Show nearby tags" is turned off, selecting "Update" from the File
menu will cause a Tcl error.  This fixes it.  The problem was that
we were calling regetallcommits unconditionally, but it assumed that
getallcommits had been called previously.  This also restructures
{re,}getallcommits to be a bit simpler.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-13 15:02:02 +10:00