git.git
18 years agoMake sure quickfetch is not fooled with a previous, incomplete fetch.
Junio C Hamano [Mon, 16 Apr 2007 07:42:29 +0000 (00:42 -0700)]
Make sure quickfetch is not fooled with a previous, incomplete fetch.

This updates git-rev-list --objects to be a bit more careful
when listing a blob object to make sure the blob actually
exists, and uses it to make sure the quick-fetch optimization we
introduced earlier is not fooled by a previous incomplete fetch.

The quick-fetch optimization works by running this command:

git rev-list --objects <<commit-list>> --not --all

where <<commit-list>> is a list of commits that we are going to
fetch from the other side.  If there is any object missing to
complete the <<commit-list>>, the rev-list would fail and die
(say, the commit was in our repository, but its tree wasn't --
then it will barf while trying to list the blobs the tree
contains because it cannot read that tree).

Usually we do not have the objects (otherwise why would we
fetching?), but in one important special case we do: when the
remote repository is used as an alternate object store
(i.e. pointed by .git/objects/info/alternates).  We could check
.git/objects/info/alternates to see if the remote we are
interacting with is one of them (or is used as an alternate,
recursively, by one of them), but that check is more cumbersome
than it is worth.

The above check however did not catch missing blob, because
object listing code did not read nor check blob objects, knowing
that blobs do not contain any further references to other
objects.  This commit fixes it with practically unmeasurable
overhead.

I've benched this with

git rev-list --objects --all >/dev/null

in the kernel repository, with three different implementations
of the "check-blob".

 - Checking with has_sha1_file() has negligible (unmeasurable)
   performance penalty.

 - Checking with sha1_object_info() makes it somewhat slower,
   perhaps by 5%.

 - Checking with read_sha1_file() to cause a fully re-validation
   is prohibitively expensive (about 4 times as much runtime).

In my original patch, I had this as a command line option, but
the overhead is small enough that it is not really worth it.

Signed-off-by: Junio C Hamano <redacted>
18 years agoClean up object creation to use more common code
Linus Torvalds [Tue, 17 Apr 2007 05:11:43 +0000 (22:11 -0700)]
Clean up object creation to use more common code

This replaces the fairly odd "created_object()" function that did _most_
of the object setup with a more complete "create_object()" function that
also has a more natural calling convention.

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoUse proper object allocators for unknown object nodes too
Linus Torvalds [Tue, 17 Apr 2007 05:10:19 +0000 (22:10 -0700)]
Use proper object allocators for unknown object nodes too

We used to use a different allocator scheme for when we didn't know the
object type.  That meant that objects that were created without any
up-front knowledge of the type would not go through the same allocation
paths as normal object allocations, and would miss out on the statistics.

But perhaps more importantly than the statistics (that are useful when
looking at memory usage but not much else), if we want to make the
object hash tables use a denser object pointer representation, we need
to make sure that they all go through the same blocking allocator.

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoBisect: rename "t/t6030-bisect-run.sh" to "t/t6030-bisect-porcelain.sh".
Christian Couder [Tue, 17 Apr 2007 04:51:48 +0000 (06:51 +0200)]
Bisect: rename "t/t6030-bisect-run.sh" to "t/t6030-bisect-porcelain.sh".

[jc: also fix 0a5280a9 that incorrectly changed the title of one test.]

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoBisect: simplify "bisect start" logging.
Christian Couder [Tue, 17 Apr 2007 04:40:50 +0000 (06:40 +0200)]
Bisect: simplify "bisect start" logging.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agopack-objects: better check_object() performances
Nicolas Pitre [Mon, 16 Apr 2007 16:32:13 +0000 (12:32 -0400)]
pack-objects: better check_object() performances

With large amount of objects, check_object() is really trashing the pack
sliding map and the filesystem cache.  It has a completely random access
pattern especially with old objects where delta replay jumps back and
forth all over the pack.

This patch improves things by:

 1) sorting objects by their offset in pack before calling check_object()
    so the pack access pattern is linear;

 2) recording the object type at add_object_entry() time since it is
    already known in most cases;

 3) recording the pack offset even for preferred_base objects;

 4) avoid calling sha1_object_info() if all possible.

This limits pack accesses to the bare minimum and makes them perfectly
linear.

In the process check_object() was made more clear (to me at least).

Note: I thought about walking the sorted_by_offset list backward in
get_object_details() so if a pack happens to be larger than the available
file cache, then the cache would have been populated with useful data from
the beginning of the pack already when find_deltas() is called.  Strangely,
testing (on Linux) showed absolutely no performance difference.

Signed-off-by: Nicolas Pitre <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoadd get_size_from_delta()
Nicolas Pitre [Mon, 16 Apr 2007 16:31:56 +0000 (12:31 -0400)]
add get_size_from_delta()

... which consists of existing code split out of packed_delta_info()
for other callers to use it as well.

Signed-off-by: Nicolas Pitre <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agopack-objects: make in_pack_header_size a variable of its own
Nicolas Pitre [Mon, 16 Apr 2007 16:31:31 +0000 (12:31 -0400)]
pack-objects: make in_pack_header_size a variable of its own

It currently aliases delta_size on the principle that reused deltas won't
go through the whole delta matching loop hence delta_size was unused.
This is not true if given delta doesn't find its base in the pack though.
But we need that information even for whole object data reuse.

Well in short the current state looks awful and is prone to bugs.  It just
works fine now because try_delta() tests trg_entry->delta before using
trg_entry->delta_size, but that is a bit subtle and I was wondering for a
while why things just worked fine... even if I'm guilty of having
introduced this abomination myself in the first place.

Let's do the sensible thing instead with no ambiguity, which is to have
a separate variable for in_pack_header_size.  This might even help future
optimizations.

While at it, let's reorder some struct object_entry members so they all
align well with their own width, regardless of the architecture or the
size of off_t.  Some memory saving is to be expected with this alone.

Signed-off-by: Nicolas Pitre <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agopack-objects: get rid of create_final_object_list()
Nicolas Pitre [Mon, 16 Apr 2007 16:31:05 +0000 (12:31 -0400)]
pack-objects: get rid of create_final_object_list()

Because we don't have to know the SHA1 h(hence the name) of the pack
up front anymore, let's get rid of yet another global sorted object list
and sort them only in write_index_file(), then compute the object list
SHA1 on the fly.

This has the advantage of saving another chunk of memory, and the sorted
list SHA1 won't be computed needlessly on servers during a fetch.

Of course the cunning plan is also to make write_index_file() much like
the function with the same name in index-pack.c for an eventual easy
sharing.

Signed-off-by: Nicolas Pitre <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agopack-objects: get rid of reuse_cached_pack
Nicolas Pitre [Mon, 16 Apr 2007 16:30:15 +0000 (12:30 -0400)]
pack-objects: get rid of reuse_cached_pack

This capability is practically never useful, and therefore never tested,
because it is fairly unlikely that the requested pack will be already
available.  Furthermore it is of little gain over the ability to reuse
existing pack data.

In fact the ability to change delta type on the fly when reusing delta
data is a nice thing that has almost no cost and allows greater backward
compatibility with a client's capabilities than if the client is blindly
sent a whole pack without any discrimination.

And this "feature" is simply in the way of other cleanups.
Let's get rid of it.

Signed-off-by: Nicolas Pitre <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agopack-objects: clean up list sorting
Nicolas Pitre [Mon, 16 Apr 2007 16:29:54 +0000 (12:29 -0400)]
pack-objects: clean up list sorting

Get rid of sort_comparator() as it impose a run time double indirect
function call for little compile time type checking gain.

Also get rid of create_sorted_list() as it only has one user which would
as well be just fine doing its sorting locally.  Eventually the list of
deltifiable objects might be shorter than the whole object list.

Signed-off-by: Nicolas Pitre <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agopack-objects: rework check_delta_limit usage
Nicolas Pitre [Mon, 16 Apr 2007 16:29:16 +0000 (12:29 -0400)]
pack-objects: rework check_delta_limit usage

Objects that have delta "children" from pack data reuse must consider the
depth of their deepest child when they try to deltify themselves for those
children not to become too deep.

However, in the context of a "thin" pack, the delta children depth was
skipped entirely on the presumption that the pack was always going to be
exploded on the receiving end, hence the delta length wasn't an issue.

Now that we keep received packs as is and reuse pack data when repacking,
those packs do contain delta chains that are longer than expected. Worse,
those delta chain may even grow longer when the pack is further repacked
into another thin pack for a subsequent transmission.

So this patch restores strict delta length even for thin packs, and it
moves check_delta_limit() usage directly in the delta loop where it is
needed.  This way the delta_limit can be removed from struct object_entry
as well.  Oh and the initial value was wrong too.

The  progress_interval() function was moved to a more logical location in
the process.

Signed-off-by: Nicolas Pitre <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agopack-objects: equal objects in size should delta against newer objects
Nicolas Pitre [Mon, 16 Apr 2007 16:28:52 +0000 (12:28 -0400)]
pack-objects: equal objects in size should delta against newer objects

Before finding best delta combinations, we sort objects by name hash,
then by size, then by their position in memory.  Then we walk the list
backwards to test delta candidates.

We hope that a bigger size usually means a newer objects.  But a bigger
address in memory does not mean a newer object.  So the last comparison
must be reversed.

Signed-off-by: Nicolas Pitre <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agopack-objects: optimize preferred base handling a bit
Nicolas Pitre [Mon, 16 Apr 2007 16:28:10 +0000 (12:28 -0400)]
pack-objects: optimize preferred base handling a bit

Let's avoid some cycles when there is no base to test against, and avoid
unnecessary object lookups.

Signed-off-by: Nicolas Pitre <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoMerge branch 'js/wrap-log'
Junio C Hamano [Mon, 16 Apr 2007 23:53:29 +0000 (16:53 -0700)]
Merge branch 'js/wrap-log'

* js/wrap-log:
  Fix permissions on test scripts
  Fix t4201: accidental arithmetic expansion
  shortlog -w: make wrap-line behaviour optional.
  Use print_wrapped_text() in shortlog

18 years agoFix permissions on test scripts
Alex Riesen [Fri, 13 Apr 2007 20:13:51 +0000 (22:13 +0200)]
Fix permissions on test scripts

Make every test executable. Remove exec-attribute from included shell files,
they can't used standalone anyway.

Signed-off-by: Alex Riesen <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoFix t4201: accidental arithmetic expansion
Alex Riesen [Fri, 13 Apr 2007 20:13:10 +0000 (22:13 +0200)]
Fix t4201: accidental arithmetic expansion

instead of embedded subshell. It actually breaks here (dash as /bin/sh):

t4201-shortlog.sh: 27: Syntax error: Missing '))'
FATAL: Unexpected exit with code 2

Signed-off-by: Alex Riesen <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agosend-email: do not leave an empty CC: line if no cc is present.
Junio C Hamano [Mon, 16 Apr 2007 23:51:47 +0000 (16:51 -0700)]
send-email: do not leave an empty CC: line if no cc is present.

Signed-off-by: Junio C Hamano <redacted>
18 years agoAdd support for "commit name decorations" to log family of commands
Linus Torvalds [Mon, 16 Apr 2007 23:05:10 +0000 (16:05 -0700)]
Add support for "commit name decorations" to log family of commands

This adds "--decorate" as a log option, which prints out the ref names
of any commits that are shown.

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoAdd a generic "object decorator" interface, and make object refs use it
Linus Torvalds [Mon, 16 Apr 2007 23:03:15 +0000 (16:03 -0700)]
Add a generic "object decorator" interface, and make object refs use it

This allows you to add an arbitrary "decoration" of your choice to any
object.  It's a space- and time-efficient way to add information to
arbitrary objects, especially if most objects probably do not have the
decoration.

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoMerge branch 'maint'
Junio C Hamano [Mon, 16 Apr 2007 09:54:18 +0000 (02:54 -0700)]
Merge branch 'maint'

* maint:
  Have sample update hook not refuse deleting a branch through push.
  variable $projectdesc needs to be set before checking against unchanged default.
  Update git-annotate/git-blame documentation
  Update git-apply documentation
  Update git-applymbox documentation
  Update git-am documentation
  user-manual: use detached head when rewriting history
  user-manual: start revising "internals" chapter
  user-manual: detached HEAD
  user-manual: fix discussion of default clone
  Documentation: clarify track/no-track option.
  Documentation: clarify git-checkout -f, minor editing
  Documentation: minor edits of git-lost-found manpage

18 years agoHave sample update hook not refuse deleting a branch through push.
Gerrit Pape [Mon, 16 Apr 2007 08:31:35 +0000 (08:31 +0000)]
Have sample update hook not refuse deleting a branch through push.

source ref might be 0000...0000 to delete a branch through git-push,
'git <remote> push :<branch>'.  The update hook should not decline this.

Signed-off-by: Gerrit Pape <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agovariable $projectdesc needs to be set before checking against unchanged default.
Gerrit Pape [Mon, 16 Apr 2007 08:30:42 +0000 (08:30 +0000)]
variable $projectdesc needs to be set before checking against unchanged default.

Signed-off-by: Gerrit Pape <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agogit-rm: Trivial fix for a comment typo.
Steven Grimm [Mon, 16 Apr 2007 08:17:32 +0000 (01:17 -0700)]
git-rm: Trivial fix for a comment typo.

Signed-off-by: Steven Grimm <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoUpdate git-annotate/git-blame documentation
Andrew Ruder [Mon, 16 Apr 2007 06:20:34 +0000 (01:20 -0500)]
Update git-annotate/git-blame documentation

Moved options that pertained to both git-blame and git-annotate to a
common file blame-options.txt.

builtin-blame.c: Removed --compatibility, --long, --time from the
short usage as they are not handled in the code.

Documentation/git-blame.txt: Removed common options to git-annotate.
Added documentation for --score-debug.  Removed --compatibility.
Adjusted usage at top to not wrap on 80 columns.

Documentation/git-annotate.txt: Using common options blame-options.txt.

Documentation/blame-options.txt: Added -b note about associated config
option, added --root note about associated config option, added
documentation for --show-stats.  Removed --long, --time, --rev-file as
those options do not really exist.  Added documentation for -M/-C taking
an optional score argument for detection of moved lines.

Signed-off-by: Andrew Ruder <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoUpdate git-apply documentation
Andrew Ruder [Mon, 16 Apr 2007 06:20:40 +0000 (01:20 -0500)]
Update git-apply documentation

Document -v (short form of --verbose).  Redo usage
to not wrap on 80 column terminal with typical
settings.

Signed-off-by: Andrew Ruder <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoUpdate git-applymbox documentation
Andrew Ruder [Mon, 16 Apr 2007 06:40:06 +0000 (01:40 -0500)]
Update git-applymbox documentation

Documentation/git-applymbox.txt: updating -u documentation to include
fact that it encodes to the i18n.commitencoding setting, not just utf-8.
Added documentation of -n option to pass -n to git-mailinfo.

Signed-off-by: Andrew Ruder <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoUpdate git-am documentation
Andrew Ruder [Mon, 16 Apr 2007 07:21:31 +0000 (02:21 -0500)]
Update git-am documentation

Documentation/git-am.txt missing several short versions
of options.  Added documentation for --resolvemsg=<msg>
command-line option.

Signed-off-by: Andrew Ruder <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agouser-manual: use detached head when rewriting history
J. Bruce Fields [Mon, 16 Apr 2007 04:37:16 +0000 (00:37 -0400)]
user-manual: use detached head when rewriting history

This is slightly simpler if we use a detached head.  And it's probably
good to have another example that uses this feature.

Signed-off-by: "J. Bruce Fields" <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agouser-manual: start revising "internals" chapter
J. Bruce Fields [Mon, 16 Apr 2007 04:37:15 +0000 (00:37 -0400)]
user-manual: start revising "internals" chapter

Minor revisions, cross-references.

Signed-off-by: "J. Bruce Fields" <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agouser-manual: detached HEAD
J. Bruce Fields [Mon, 16 Apr 2007 04:37:14 +0000 (00:37 -0400)]
user-manual: detached HEAD

Add a brief mention of detached HEADs and .git/HEAD.

Signed-off-by: "J. Bruce Fields" <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agouser-manual: fix discussion of default clone
J. Bruce Fields [Mon, 16 Apr 2007 04:37:13 +0000 (00:37 -0400)]
user-manual: fix discussion of default clone

The name "master" isn't actually quite so special.  Also, fix some bad
grammar.

Signed-off-by: "J. Bruce Fields" <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoDocumentation: clarify track/no-track option.
J. Bruce Fields [Mon, 16 Apr 2007 04:37:12 +0000 (00:37 -0400)]
Documentation: clarify track/no-track option.

Fix the description of the --no-track option so it no longer says the
opposite of what was intended.  Also mention branch.autosetupmerge
explicitly.

Signed-off-by: "J. Bruce Fields" <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoDocumentation: clarify git-checkout -f, minor editing
J. Bruce Fields [Mon, 16 Apr 2007 04:37:11 +0000 (00:37 -0400)]
Documentation: clarify git-checkout -f, minor editing

"Force a re-read of everything" doesn't mean much to me.

Also some minor grammar fixes.

Signed-off-by: "J. Bruce Fields" <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoDocumentation: minor edits of git-lost-found manpage
J. Bruce Fields [Mon, 16 Apr 2007 04:37:10 +0000 (00:37 -0400)]
Documentation: minor edits of git-lost-found manpage

Minor improvements to grammar and clarity of lost-found manpage.

Signed-off-by: "J. Bruce Fields" <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoAdd --quiet option to suppress output of "rm" commands for removed files.
Steven Grimm [Mon, 16 Apr 2007 07:46:48 +0000 (00:46 -0700)]
Add --quiet option to suppress output of "rm" commands for removed files.

Signed-off-by: Steven Grimm <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoDisplay the subject of the commit just made.
Michael S. Tsirkin [Mon, 16 Apr 2007 05:51:11 +0000 (08:51 +0300)]
Display the subject of the commit just made.

Useful e.g. to figure out what I did from screen history,
or to make sure subject line is short enough and makes sense
on its own.

Signed-off-by: Michael S. Tsirkin <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoAdd policy on user-interface changes
Andrew Ruder [Mon, 16 Apr 2007 05:35:25 +0000 (00:35 -0500)]
Add policy on user-interface changes

Documentation/SubmittingPatches: Add note that all user interface changes
should include associated documentation updates.

Signed-off-by: Andrew Ruder <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoMerge branch 'maint'
Junio C Hamano [Mon, 16 Apr 2007 00:52:07 +0000 (17:52 -0700)]
Merge branch 'maint'

* maint:
  Document -g (--walk-reflogs) option of git-log
  sscanf/strtoul: parse integers robustly
  git-blame: Fix overrun in fake_working_tree_commit()
  [PATCH] Improve look-and-feel of the gitk tool.
  [PATCH] Teach gitk to use the user-defined UI font everywhere.

18 years agoDocument -g (--walk-reflogs) option of git-log
Alex Riesen [Sun, 15 Apr 2007 22:36:06 +0000 (00:36 +0200)]
Document -g (--walk-reflogs) option of git-log

Signed-off-by: Alex Riesen <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoDocument git-check-attr
James Bowes [Sun, 15 Apr 2007 01:27:20 +0000 (21:27 -0400)]
Document git-check-attr

Signed-off-by: James Bowes <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoident.c: Use size_t (instead of int) to store sizes
Luiz Fernando N. Capitulino [Sun, 15 Apr 2007 18:51:29 +0000 (15:51 -0300)]
ident.c: Use size_t (instead of int) to store sizes

Signed-off-by: Luiz Fernando N. Capitulino <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoident.c: Use const qualifier for 'struct passwd' parameters
Luiz Fernando N. Capitulino [Sun, 15 Apr 2007 21:40:31 +0000 (18:40 -0300)]
ident.c: Use const qualifier for 'struct passwd' parameters

Signed-off-by: Luiz Fernando N. Capitulino <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoChange attribute negation marker from '!' to '-'.
Junio C Hamano [Sun, 15 Apr 2007 21:56:09 +0000 (14:56 -0700)]
Change attribute negation marker from '!' to '-'.

At the same time, we do not want to allow arbitrary strings for
attribute names, as we are likely to want to extend the syntax
later.  Allow only alnum, dash, underscore and dot for now.

Signed-off-by: Junio C Hamano <redacted>
18 years agoDefine a built-in attribute macro "binary".
Junio C Hamano [Sat, 14 Apr 2007 15:56:35 +0000 (08:56 -0700)]
Define a built-in attribute macro "binary".

For binary files we would want to disable textual diff
generation and automatic crlf conversion.

Signed-off-by: Junio C Hamano <redacted>
18 years agoattribute macro support
Junio C Hamano [Sat, 14 Apr 2007 15:54:37 +0000 (08:54 -0700)]
attribute macro support

This adds "attribute macros" (for lack of better name).  So far,
we have low-level attributes such as crlf and diff, which are
defined in operational terms --- setting or unsetting them on a
particular path directly affects what is done to the path.  For
example, in order to decline diffs or crlf conversions on a
binary blob, no diffs on PostScript files, and treat all other
files normally, you would have something like these:

* diff crlf
*.ps !diff
proprietary.o !diff !crlf

That is fine as the operation goes, but gets unwieldy rather
rapidly, when we start adding more low-level attributes that are
defined in operational terms.  A near-term example of such an
attribute would be 'merge-3way' which would control if git
should attempt the usual 3-way file-level merge internally, or
leave merging to a specialized external program of user's
choice.  When it is added, we do _not_ want to force the users
to update the above to:

* diff crlf merge-3way
*.ps !diff
proprietary.o !diff !crlf !merge-3way

The way this patch solves this issue is to realize that the
attributes the user is assigning to paths are not defined in
terms of operations but in terms of what they are.

All of the three low-level attributes usually make sense for
most of the files that sane SCM users have git operate on (these
files are typically called "text').  Only a few cases, such as
binary blob, need exception to decline the "usual treatment
given to text files" -- and people mark them as "binary".

So this allows the $GIT_DIR/info/alternates and .gitattributes
at the toplevel of the project to also specify attributes that
assigns other attributes.  The syntax is '[attr]' followed by an
attribute name followed by a list of attribute names:

[attr] binary !diff !crlf !merge-3way

When "binary" attribute is set to a path, if the path has not
got diff/crlf/merge-3way attribute set or unset by other rules,
this rule unsets the three low-level attributes.

It is expected that the user level .gitattributes will be
expressed mostly in terms of attributes based on what the files
are, and the above sample would become like this:

(built-in attribute configuration)
[attr] binary !diff !crlf !merge-3way
* diff crlf merge-3way

(project specific .gitattributes)
proprietary.o binary

(user preference $GIT_DIR/info/attributes)
*.ps !diff

There are a few caveats.

 * As described above, you can define these macros only in
   $GIT_DIR/info/attributes and toplevel .gitattributes.

 * There is no attempt to detect circular definition of macro
   attributes, and definitions are evaluated from bottom to top
   as usual to fill in other attributes that have not yet got
   values.  The following would work as expected:

[attr] text diff crlf
[attr] ps text !diff
*.ps ps

   while this would most likely not (I haven't tried):

[attr] ps text !diff
[attr] text diff crlf
*.ps ps

 * When a macro says "[attr] A B !C", saying that a path does
   not have attribute A does not let you tell anything about
   attributes B or C.  That is, given this:

[attr] text diff crlf
[attr] ps text !diff
*.txt !ps

  path hello.txt, which would match "*.txt" pattern, would have
  "ps" attribute set to zero, but that does not make text
  attribute of hello.txt set to false (nor diff attribute set to
  true).

Signed-off-by: Junio C Hamano <redacted>
18 years agoMakefile: add patch-ids.h back in.
Junio C Hamano [Sun, 15 Apr 2007 20:39:32 +0000 (13:39 -0700)]
Makefile: add patch-ids.h back in.

I lost it by mistake while shuffling the gitattributes series which
originally was on top of the subproject topic onto the master branch.

Signed-off-by: Junio C Hamano <redacted>
18 years agoFix 'diff' attribute semantics.
Junio C Hamano [Sun, 15 Apr 2007 21:35:11 +0000 (14:35 -0700)]
Fix 'diff' attribute semantics.

This is in the same spirit as the previous one.  Earlier 'diff'
meant 'do the built-in binary heuristics and disable patch text
generation based on it' while '!diff' meant 'do not guess, do
not generate patch text'.  There was no way to say 'do generate
patch text even when the heuristics says it has NUL in it'.

Signed-off-by: Junio C Hamano <redacted>
18 years agoFix 'crlf' attribute semantics.
Junio C Hamano [Sun, 15 Apr 2007 20:35:45 +0000 (13:35 -0700)]
Fix 'crlf' attribute semantics.

Earlier we said 'crlf lets the path go through core.autocrlf
process while !crlf disables it altogether'.  This fixes the
semantics to:

 - Lack of 'crlf' attribute makes core.autocrlf to apply
   (i.e. we guess based on the contents and if platform
   expresses its desire to have CRLF line endings via
   core.autocrlf, we do so).

 - Setting 'crlf' attribute to true forces CRLF line endings in
   working tree files, even if blob does not look like text
   (e.g. contains NUL or other bytes we consider binary).

 - Setting 'crlf' attribute to false disables conversion.

Signed-off-by: Junio C Hamano <redacted>
18 years agoExpose subprojects as special files to "git diff" machinery
Linus Torvalds [Sun, 15 Apr 2007 18:14:28 +0000 (11:14 -0700)]
Expose subprojects as special files to "git diff" machinery

The same way we generate diffs on symlinks as the the diff of text of the
symlink, we can generate subproject diffs (when not recursing into them!)
as the diff of the text that describes the subproject.

Of course, since what descibes a subproject is just the SHA1, that's what
we'll use. Add some pretty-printing to make it a bit more obvious what is
going on, and we're done.

So with this, we can get both raw diffs and "textual" diffs of subproject
changes:

 - git diff --raw:

:160000 160000 2de597b5ad348b7db04bd10cdd38cd81cbc93ab5 0000000... M    sub-A

 - git diff:

diff --git a/sub-A b/sub-A
index 2de597b..e8f11a4 160000
--- a/sub-A
+++ b/sub-A
@@ -1 +1 @@
-Subproject commit 2de597b5ad348b7db04bd10cdd38cd81cbc93ab5
+Subproject commit e8f11a45c5c6b9e2fec6d136d3fb5aff75393d42

NOTE! We'll also want to have the ability to recurse into the subproject
and actually diff it recursively, but that will involve a new command line
option (I'd suggest "--subproject" and "-S", but the latter is in use by
pickaxe), and some very different code.

But regardless of ay future recursive behaviour, we need the non-recursive
version too (and it should be the default, at least in the absense of
config options, so that large superprojects don't default to something
extremely expensive).

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoHandle patch errors in git-p4 submit better.
Simon Hausmann [Sun, 15 Apr 2007 07:59:56 +0000 (09:59 +0200)]
Handle patch errors in git-p4 submit better.

Signed-off-by: Simon Hausmann <redacted>
18 years agoA new attempt at fixing the child-fast-import-process-not-finished race condition
Simon Hausmann [Sun, 15 Apr 2007 07:34:15 +0000 (09:34 +0200)]
A new attempt at fixing the child-fast-import-process-not-finished race condition
in the clone command

Signed-off-by: Simon Hausmann <redacted>
18 years agogit-gui: Display the directory basename in the title
Shawn O. Pearce [Sat, 14 Apr 2007 19:10:48 +0000 (15:10 -0400)]
git-gui: Display the directory basename in the title

By showing the basename of the directory very early in the
title bar I can more easily locate a particular git-gui
session when I have 8 open at once and my  Windows taskbar
is overflowing with items.

Signed-off-by: Shawn O. Pearce <redacted>
18 years agoMerge branch 'er/ui'
Shawn O. Pearce [Sun, 15 Apr 2007 04:34:28 +0000 (00:34 -0400)]
Merge branch 'er/ui'

* er/ui:
  Always bind the return key to the default button
  Do not break git-gui messages into multiple lines.
  Improve look-and-feel of the git-gui tool.
  Teach git-gui to use the user-defined UI font everywhere.
  Allow wish interpreter to be defined with TCLTK_PATH

18 years agosscanf/strtoul: parse integers robustly
Jim Meyering [Mon, 9 Apr 2007 23:01:44 +0000 (01:01 +0200)]
sscanf/strtoul: parse integers robustly

* builtin-grep.c (strtoul_ui): Move function definition from here, to...
* git-compat-util.h (strtoul_ui): ...here, with an added "base" parameter.
* builtin-grep.c (cmd_grep): Update use of strtoul_ui to include base, "10".
* builtin-update-index.c (read_index_info): Diagnose an invalid mode integer
that is out of range or merely larger than INT_MAX.
(cmd_update_index): Use strtoul_ui, not sscanf.
* convert-objects.c (write_subdirectory): Likewise.

Signed-off-by: Jim Meyering <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoMerge git://git2.kernel.org/pub/scm/gitk/gitk into maint
Junio C Hamano [Sun, 15 Apr 2007 02:45:16 +0000 (19:45 -0700)]
Merge git://git2./pub/scm/gitk/gitk into maint

* git://git2.kernel.org/pub/scm/gitk/gitk:
  [PATCH] Improve look-and-feel of the gitk tool.
  [PATCH] Teach gitk to use the user-defined UI font everywhere.

18 years agoFix some "git ls-files -o" fallout from gitlinks
Linus Torvalds [Sat, 14 Apr 2007 23:22:08 +0000 (16:22 -0700)]
Fix some "git ls-files -o" fallout from gitlinks

Since "git ls-files" doesn't really pass down any details on what it
really wants done to the directory walking code, the directory walking
code doesn't really know whether the caller wants to know about gitlink
directories, or whether it wants to just know about ignored files.

So the directory walking code will return those gitlink directories unless
the caller has explicitly told it not to ("dir->show_other_directories"
tells the directory walker to only show "other" directories).

This kind of confuses "git ls-files -o", because
 - it didn't really expect to see entries listed that were already in the
   index, unless they  were unmerged, and would die on that unexpected
   setup, rather than just "continue".
 - it didn't know how to match directory entries with the final "/"

This trivial change updates the "show_other_files()" function to handle
both of these issues gracefully. There really was no reason to die, when
the obviously correct thing for the function was to just ignore files it
already knew about (that's what "other" means here!).

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agogit-blame: Fix overrun in fake_working_tree_commit()
Michael Spang [Sat, 14 Apr 2007 21:26:20 +0000 (17:26 -0400)]
git-blame: Fix overrun in fake_working_tree_commit()

git-blame would overflow commit->buffer when annotating files with long paths.

Signed-off-by: Michael Spang <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoTeach 'diff' about 'diff' attribute.
Junio C Hamano [Fri, 13 Apr 2007 06:05:29 +0000 (23:05 -0700)]
Teach 'diff' about 'diff' attribute.

This makes paths that explicitly unset 'diff' attribute not to
produce "textual" diffs from 'git-diff' family.

Signed-off-by: Junio C Hamano <redacted>
18 years agoDefine 'crlf' attribute.
Junio C Hamano [Fri, 13 Apr 2007 05:30:05 +0000 (22:30 -0700)]
Define 'crlf' attribute.

This defines the semantics of 'crlf' attribute as an example.
When a path has this attribute unset (i.e. '!crlf'), autocrlf
line-end conversion is not applied.

Eventually we would want to let users to build a pipeline of
processing to munge blob data to filesystem format (and in the
other direction) based on combination of attributes, and at that
point the mechanism in convert_to_{git,working_tree}() that
looks at 'crlf' attribute needs to be enhanced.  Perhaps the
existing 'crlf' would become the first step in the input chain,
and the last step in the output chain.

Signed-off-by: Junio C Hamano <redacted>
18 years agoAdd basic infrastructure to assign attributes to paths
Junio C Hamano [Thu, 12 Apr 2007 08:07:32 +0000 (01:07 -0700)]
Add basic infrastructure to assign attributes to paths

This adds the basic infrastructure to assign attributes to
paths, in a way similar to what the exclusion mechanism does
based on $GIT_DIR/info/exclude and .gitignore files.

An attribute is just a simple string that does not contain any
whitespace.  They can be specified in $GIT_DIR/info/attributes
file, and .gitattributes file in each directory.

Each line in these files defines a pattern matching rule.
Similar to the exclusion mechanism, a later match overrides an
earlier match in the same file, and entries from .gitattributes
file in the same directory takes precedence over the ones from
parent directories.  Lines in $GIT_DIR/info/attributes file are
used as the lowest precedence default rules.

A line is either a comment (an empty line, or a line that begins
with a '#'), or a rule, which is a whitespace separated list of
tokens.  The first token on the line is a shell glob pattern.
The rest are names of attributes, each of which can optionally
be prefixed with '!'.  Such a line means "if a path matches this
glob, this attribute is set (or unset -- if the attribute name
is prefixed with '!').  For glob matching, the same "if the
pattern does not have a slash in it, the basename of the path is
matched with fnmatch(3) against the pattern, otherwise, the path
is matched with the pattern with FNM_PATHNAME" rule as the
exclusion mechanism is used.

This does not define what an attribute means.  Tying an
attribute to various effects it has on git operation for paths
that have it will be specified separately.

Signed-off-by: Junio C Hamano <redacted>
18 years agoSlightly improved formatting of the raw_input questions.
Simon Hausmann [Sat, 14 Apr 2007 14:09:43 +0000 (16:09 +0200)]
Slightly improved formatting of the raw_input questions.

Signed-off-by: Simon Hausmann <redacted>
18 years agoRemoved the old patch apply code from git-p4 submit.
Simon Hausmann [Sat, 14 Apr 2007 14:05:54 +0000 (16:05 +0200)]
Removed the old patch apply code from git-p4 submit.

Signed-off-by: Simon Hausmann <redacted>
18 years agoMerge branch 'maint'
Junio C Hamano [Sat, 14 Apr 2007 11:18:46 +0000 (04:18 -0700)]
Merge branch 'maint'

* maint:
  git-quiltimport complaining yet still working
  config.txt: Fix grammatical error in description of http.noEPSV
  config.txt: Change pserver to server in description of gitcvs.*
  config.txt: Document core.autocrlf
  config.txt: Document gitcvs.allbinary
  Do not default to --no-index when given two directories.
  Use rev-list --reverse in git-rebase.sh

18 years agogit-quiltimport complaining yet still working
Linus Torvalds [Fri, 13 Apr 2007 21:34:18 +0000 (14:34 -0700)]
git-quiltimport complaining yet still working

There were two bugs: "stop_here" doesn't exist, but the bug that causes
this code to trigger in the *first* place is the wrong use of "$dotest".
It should be ".dotest"

This is essentially the same bug introduced by 87ab7992, one was
fixed with 0d38ab25 but this was somehow left behind.

Signed-off-by: Junio C Hamano <redacted>
18 years agoReplace a pair of patches with updated ones for subproject support.
Junio C Hamano [Sat, 14 Apr 2007 10:21:56 +0000 (03:21 -0700)]
Replace a pair of patches with updated ones for subproject support.

This series of three patches is a *replacement* for the patch series of
two patches (plus one-liner fixup) I sent yesterday.

It fixes the issue I noted with "git status" incorrectly
claiming that a non-checked out subproject wasn't clean - that
was just a total thinko in the code (we were checking the
filesystem mode against S_IFDIRLNK, which obviously cannot work,
since S_IFDIRLINK is a git-internal state, not a filesystem
state).

It then re-sends the two patches on top of that, with the fix
for checking out superprojects (we should *not* mess up any
existing subproject directories, certainly not remove them - if
we already have a directory in the place where we now want a
subproject, we should leave it well alone!)

The first one really is a fix, and it makes the commit
commentary about a remaining bug in the patch I sent out
yesterday go away.

18 years agoTeach "git-read-tree -u" to check out submodules as a directory
Linus Torvalds [Fri, 13 Apr 2007 16:26:04 +0000 (09:26 -0700)]
Teach "git-read-tree -u" to check out submodules as a directory

This actually allows us to check out a supermodule after cloning, although
the submodules themselves will obviously not be checked out, and will just
be empty directories.

Checking out the submodules will be up to higher levels - we may not even
want to!

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoTeach git list-objects logic to not follow gitlinks
Linus Torvalds [Fri, 13 Apr 2007 16:25:01 +0000 (09:25 -0700)]
Teach git list-objects logic to not follow gitlinks

This allows us to pack superprojects and thus clone them (but not yet
check them out on the receiving side.. That's the next patch)

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoFix gitlink index entry filesystem matching
Linus Torvalds [Fri, 13 Apr 2007 16:24:13 +0000 (09:24 -0700)]
Fix gitlink index entry filesystem matching

The code to match up index entries with the filesystem was stupidly
broken.  We shouldn't compare the filesystem stat() information with
S_IFDIRLNK, since that's purely a git-internal value, and not what the
filesystem uses (on the filesystem, it's just a regular directory).

Also, don't bother to make the stat() time comparisons etc for DIRLNK
entries in ce_match_stat_basic(), since we do an exact match for these
things, and the hints in the stat data simply doesn't matter.

This fixes "git status" with submodules that haven't been checked out in
the supermodule.

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoFix the timezone formatting. Now qgit also displays (parses) it correctly.
Simon Hausmann [Sat, 14 Apr 2007 09:21:50 +0000 (11:21 +0200)]
Fix the timezone formatting. Now qgit also displays (parses) it correctly.

Signed-off-by: Simon Hausmann <redacted>
18 years agoconfig.txt: Add gitcvs.db* variables
Frank Lichtenheld [Fri, 13 Apr 2007 16:13:42 +0000 (18:13 +0200)]
config.txt: Add gitcvs.db* variables

Adds documentation for gitcvs.{dbname,dbdriver,dbuser,dbpass}
Texts are mostly taken from git-cvsserver.txt whith some
adaptions so that they make more sense out of the context
of the original man page.

Signed-off-by: Frank Lichtenheld <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoconfig.txt: Fix grammatical error in description of http.noEPSV
Frank Lichtenheld [Fri, 13 Apr 2007 16:02:33 +0000 (18:02 +0200)]
config.txt: Fix grammatical error in description of http.noEPSV

s/doesn't/don't/ since "ftp servers" is plural

Signed-off-by: Frank Lichtenheld <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoconfig.txt: Change pserver to server in description of gitcvs.*
Frank Lichtenheld [Fri, 13 Apr 2007 16:02:32 +0000 (18:02 +0200)]
config.txt: Change pserver to server in description of gitcvs.*

These variables apply to the SSH access as well, so don't use
pserver here which might confuse users.

Signed-off-by: Frank Lichtenheld <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoconfig.txt: Document core.autocrlf
Frank Lichtenheld [Fri, 13 Apr 2007 16:02:31 +0000 (18:02 +0200)]
config.txt: Document core.autocrlf

Text shamelessly stolen from the 1.5.1 release notes.

Signed-off-by: Frank Lichtenheld <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoconfig.txt: Document gitcvs.allbinary
Frank Lichtenheld [Fri, 13 Apr 2007 16:02:30 +0000 (18:02 +0200)]
config.txt: Document gitcvs.allbinary

Signed-off-by: Frank Lichtenheld <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoDo not default to --no-index when given two directories.
Junio C Hamano [Fri, 13 Apr 2007 10:23:20 +0000 (03:23 -0700)]
Do not default to --no-index when given two directories.

git-diff -- a/ b/ always defaulted to --no-index, primarily
because the function is_in_index() was implemented quite
incorrectly.

Noticed by Patrick Maaß and Simon Schubert independently,
initial patch was provided by Patrick but I fixed it
differently.

Signed-off-by: Junio C Hamano <redacted>
18 years agoUse rev-list --reverse in git-rebase.sh
Alex Riesen [Fri, 13 Apr 2007 22:19:05 +0000 (00:19 +0200)]
Use rev-list --reverse in git-rebase.sh

...and drop the last perl dependency in the script.

Signed-off-by: Alex Riesen <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoPrint an error message of some sort if git fast-import fails.
Simon Hausmann [Fri, 13 Apr 2007 20:21:10 +0000 (22:21 +0200)]
Print an error message of some sort if git fast-import fails.

Signed-off-by: Simon Hausmann <redacted>
18 years agoTeach "git-read-tree -u" to check out submodules as a directory
Linus Torvalds [Fri, 13 Apr 2007 04:08:52 +0000 (21:08 -0700)]
Teach "git-read-tree -u" to check out submodules as a directory

This actually allows us to check out a supermodule after cloning, although
the submodules will obviously not be checked out, and will just be an
empty subdirectory.

[ Side note: this also shows that we currently don't correctly handle
  such subprojects that aren't checked out correctly yet.  They should
  always show up as not being modified, but failing to resolve the
  gitlink HEAD does not properly trigger the "not modified" logic in all
  places it needs to..

  So more work to be done, but that's a separate issue, unrelated to
  the action of checking out the superproject. ]

The bulk of this patch is simply because we need to check the type of the
index entry *before* we try to read the object it points to, and that
meant that the code needed some re-organization. So I moved some of the
code in common to both symlinks and files to be a trivial helper function.

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoTeach git list-objects logic not to follow gitlinks
Linus Torvalds [Fri, 13 Apr 2007 04:03:39 +0000 (21:03 -0700)]
Teach git list-objects logic not to follow gitlinks

This allows us to pack superprojects and thus clone them (but not yet
check them out on the receiving side - that's the next patch)

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoMerge branch 'jc/cherry'
Junio C Hamano [Fri, 13 Apr 2007 04:04:27 +0000 (21:04 -0700)]
Merge branch 'jc/cherry'

* jc/cherry:
  Documentation: --cherry-pick
  git-log --cherry-pick A...B
  Refactor patch-id filtering out of git-cherry and git-format-patch.
  Add %m to '--pretty=format:'

18 years agoMerge branch 'maint'
Junio C Hamano [Fri, 13 Apr 2007 04:04:09 +0000 (21:04 -0700)]
Merge branch 'maint'

* maint:
  handle_options in git wrapper miscounts the options it handled.

18 years agohandle_options in git wrapper miscounts the options it handled.
Matthias Lederhofer [Thu, 12 Apr 2007 18:52:03 +0000 (20:52 +0200)]
handle_options in git wrapper miscounts the options it handled.

handle_options did not count the number of used arguments
correctly.  When --git-dir was used the extra argument was
not added to the number of handled arguments.

Signed-off-by: Matthias Lederhofer <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoFix git {log,show,...} --pretty=email
Junio C Hamano [Thu, 12 Apr 2007 10:04:05 +0000 (03:04 -0700)]
Fix git {log,show,...} --pretty=email

An earlier --subject-prefix patch forgot that format-patch is
not the only codepath that adds the "[PATCH]" prefix, and broke
everybody else in the log family.

Signed-off-by: Junio C Hamano <redacted>
18 years agoDon't yap about merge-subtree during make
Shawn O. Pearce [Thu, 12 Apr 2007 05:21:18 +0000 (01:21 -0400)]
Don't yap about merge-subtree during make

By default we are pretty quiet about the actual commands that
we are running.  So we should continue to be quiet about the new
merge-subtree hardlink to merge-recursive.  Technically this is not
a builtin, but it is close because subtree is actually builtin to
a non-builtin.  So lets just make things easy and call it a builtin.

Signed-off-by: Shawn O. Pearce <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoDon't show gitlink directories when we want "other" files
Linus Torvalds [Thu, 12 Apr 2007 21:32:21 +0000 (14:32 -0700)]
Don't show gitlink directories when we want "other" files

When "show_other_directories" is set, that implies that we are looking
for untracked files, which obviously means that we should ignore
directories that are marked as gitlinks in the index.

This fixes "git status" in a superproject, that would otherwise always
report that subprojects were "Untracked files:"

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agocvsserver: Document the GIT branches -> CVS modules mapping more prominently
Frank Lichtenheld [Thu, 12 Apr 2007 14:54:28 +0000 (16:54 +0200)]
cvsserver: Document the GIT branches -> CVS modules mapping more prominently

Add a note about the branches -> modules mapping to LIMITATIONS because
I really think it should be noted there and not just at the end of
the installation step-by-step HOWTO.

I used "git branches" there and changed "heads" to "branches" in
my section about database configuration. I'm reluctant to replace
all occourences of "head" with "branch" though because you always
have to say "git branch" because CVS also has the concept of
branches. You can say "head" though, because there is no such
concept in CVS. In all the existing occourences of head other than
the one I changed I think "head" flows better in the text.

Signed-off-by: Frank Lichtenheld <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoTeach git-update-index about gitlinks
Linus Torvalds [Thu, 12 Apr 2007 19:29:40 +0000 (12:29 -0700)]
Teach git-update-index about gitlinks

I finally got around to looking at Alex' patch to teach update-index about
gitlinks too, so that "git commit -a" along with any other explicit
update-index scripts can work.

I don't think there was anything wrong with Alex' patch, but the code he
patched I felt was just so ugly that the added cases just pushed it over
the edge. Especially as I don't think that patch necessarily did the right
thing for a gitlink entry that already existed in the index, but that
wasn't actually a real git repository in the working tree (just an empty
subdirectory or a non-git snapshot because it hadn't wanted to track that
particular subproject).

So I ended up deciding to clean up the git-update-index handling the same
way I tackled the directory traversal used by git-add earlier: by
splitting the different cases up into multiple smaller functions, and just
making the code easier to read (and adding more comments about the
different cases).

So this replaces the old "process_file()" with a new "process_path()"
function that then just calls out to different helper functions depending
on what kind of path it is. Processing a nondirectory ends up being just
one of the simpler cases.

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agocvsserver: Reword documentation on necessity of write access
Frank Lichtenheld [Thu, 12 Apr 2007 14:43:36 +0000 (16:43 +0200)]
cvsserver: Reword documentation on necessity of write access

Reworded the section about git-cvsserver needing to update the
database.

Signed-off-by: Frank Lichtenheld <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agocvsserver: Allow to "add" a removed file
Frank Lichtenheld [Wed, 11 Apr 2007 22:51:33 +0000 (00:51 +0200)]
cvsserver: Allow to "add" a removed file

CVS allows you to add a removed file (where the
removal is not yet committed) which will
cause the server to send the latest revision of the
file and to delete the "removed" status.

Copy this behaviour.

Signed-off-by: Frank Lichtenheld <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoDocumentation: --cherry-pick
Junio C Hamano [Tue, 10 Apr 2007 22:28:32 +0000 (15:28 -0700)]
Documentation: --cherry-pick

Signed-off-by: Junio C Hamano <redacted>
18 years agogit-log --cherry-pick A...B
Junio C Hamano [Mon, 9 Apr 2007 10:40:38 +0000 (03:40 -0700)]
git-log --cherry-pick A...B

This is meant to be a saner replacement for "git-cherry".

When used with "A...B", this filters out commits whose patch
text has the same patch-id as a commit on the other side.  It
would probably most useful to use with --left-right.

Signed-off-by: Junio C Hamano <redacted>
18 years agoRefactor patch-id filtering out of git-cherry and git-format-patch.
Junio C Hamano [Tue, 10 Apr 2007 00:01:27 +0000 (17:01 -0700)]
Refactor patch-id filtering out of git-cherry and git-format-patch.

This implements the patch-id computation and recording library,
patch-ids.c, and rewrites the get_patch_ids() function used in
cherry and format-patch to use it, so that they do not pollute
the object namespace.  Earlier code threw non-objects into the
in-core object database, and hoped for not getting bitten by
SHA-1 collisions.  While it may be practically Ok, it still was
an ugly hack.

Signed-off-by: Junio C Hamano <redacted>
18 years agoAdd %m to '--pretty=format:'
Junio C Hamano [Mon, 9 Apr 2007 09:34:05 +0000 (02:34 -0700)]
Add %m to '--pretty=format:'

When used with '--boundary A...B', this shows the -/</> marker
you would get with --left-right option to 'git-log' family.
When symmetric diff is not used, everybody is shown to be on the
"right" branch.

Signed-off-by: Junio C Hamano <redacted>
18 years agoclean up add_object_entry()
Nicolas Pitre [Wed, 11 Apr 2007 02:54:36 +0000 (22:54 -0400)]
clean up add_object_entry()

This function used to call locate_object_entry_hash() _twice_ per added
object while only once should suffice. Let's reorganize that code a bit.

Signed-off-by: Nicolas Pitre <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agotests for various pack index features
Nicolas Pitre [Tue, 10 Apr 2007 20:26:10 +0000 (16:26 -0400)]
tests for various pack index features

This is a fairly complete list of tests for various aspects of pack
index versions 1 and  2.

Tests on index v2 include 32-bit and 64-bit offsets, as well as a nice
demonstration of the flawed repacking integrity checks that index
version 2 intend to solve over index version 1 with the per object CRC.

Signed-off-by: Nicolas Pitre <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agouse test-genrandom in tests instead of /dev/urandom
Nicolas Pitre [Wed, 11 Apr 2007 17:35:13 +0000 (13:35 -0400)]
use test-genrandom in tests instead of /dev/urandom

This way tests are completely deterministic and possibly more portable.

Signed-off-by: Nicolas Pitre <redacted>
18 years agosimple random data generator for tests
Nicolas Pitre [Wed, 11 Apr 2007 17:59:51 +0000 (13:59 -0400)]
simple random data generator for tests

Reliance on /dev/urandom produces test vectors that are, well, random.
This can cause problems impossible to track down when the data is
different from one test invokation to another.

The goal is not to have random data to test, but rather to have a
convenient way to create sets of large files with non compressible and
non deltifiable data in a reproducible way.

Signed-off-by: Nicolas Pitre <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agosscanf/strtoul: parse integers robustly
Jim Meyering [Mon, 9 Apr 2007 23:01:44 +0000 (01:01 +0200)]
sscanf/strtoul: parse integers robustly

* builtin-grep.c (strtoul_ui): Move function definition from here, to...
* git-compat-util.h (strtoul_ui): ...here, with an added "base" parameter.
* builtin-grep.c (cmd_grep): Update use of strtoul_ui to include base, "10".
* builtin-update-index.c (read_index_info): Diagnose an invalid mode integer
that is out of range or merely larger than INT_MAX.
(cmd_update_index): Use strtoul_ui, not sscanf.
* convert-objects.c (write_subdirectory): Likewise.

Signed-off-by: Jim Meyering <redacted>
Signed-off-by: Junio C Hamano <redacted>
18 years agoTeach directory traversal about subprojects
Linus Torvalds [Wed, 11 Apr 2007 21:49:44 +0000 (14:49 -0700)]
Teach directory traversal about subprojects

This is the promised cleaned-up version of teaching directory traversal
(ie the "read_directory()" logic) about subprojects. That makes "git add"
understand to add/update subprojects.

It now knows to look at the index file to see if a directory is marked as
a subproject, and use that as information as whether it should be recursed
into or not.

It also generally cleans up the handling of directory entries when
traversing the working tree, by splitting up the decision-making process
into small functions of their own, and adding a fair number of comments.

Finally, it teaches "add_file_to_cache()" that directory names can have
slashes at the end, since the directory traversal adds them to make the
difference between a file and a directory clear (it always did that, but
my previous too-ugly-to-apply subproject patch had a totally different
path for subproject directories and avoided the slash for that case).

Signed-off-by: Linus Torvalds <redacted>
Signed-off-by: Junio C Hamano <redacted>
git clone https://git.99rst.org/PROJECT