1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-05 08:47:56 +01:00
Commit graph

19244 commits

Author SHA1 Message Date
Linus Torvalds
d5a72fd622 Fix git-resolve-script.
I'd stupidly forgotten one merge_head -> merge conversion, and
all my tests were for the fast-forward case that never triggered
the bug.
2005-05-05 16:07:56 -07:00
Linus Torvalds
db823d4a5a Fix symlink handling
We really always want to have S_IFREG there for non-symlinks,
otherwise we create corrupt index files.
2005-05-05 16:01:46 -07:00
Junio C Hamano
660265909f diff-cache shows differences for unmerged paths without --cache.
While manually resolving a merge conflict, being able to run
diff-cache without --cache option between files in the work tree
and either of the ancestor trees is helpful to verify the hand
merged result.  However, diff-cache refuses to handle unmerged
paths, even when run without --cache option.

This changes the behaviour so that the above use case will
report the differences between the compared tree and the magic
0{40} SHA1 (i.e. "look at the work tree").  When there is no
corresponding file in the work tree, or when the command is run
with "--cache" option, it continues to report "unmerged".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-05 15:35:49 -07:00
Junio C Hamano
c4b83e618f Do not write out new index if nothing has changed.
The git-update-cache command, especially with --refresh, may not change
anything.  In such a case, writing 1.6MB of the same thing is a waste.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-05 15:29:06 -07:00
Junio C Hamano
9e30dd7c0e Make git-prune-script executable again.
I do not know why the executable bit was lost since the change went in as
GIT pull, not via e-mail patch, but here is a fix.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-05 15:10:49 -07:00
Thomas Glanzmann
ed4eeaf203 [PATCH] git: Mention the '-p' option in the usage help string if git-diff-tree.
Mention the '-p' option in the usage help string of git-diff-tree.

Signed-Off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
Signed-Off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-05 13:02:26 -07:00
Linus Torvalds
67cc5c4ef8 Split "git-pull-script" into two parts
Separate out the merge resolve from the actual getting of the
data. Also, update the resolve phase to take advantage of the
fact that we don't need to do the commit->tree object lookup
by hand, since all the actors involved happily just act on a
commit object these days.
2005-05-05 11:43:30 -07:00
Linus Torvalds
160c8433d9 git-diff-cache: add "-m" flag to match all non-checked-out files with the index.
This allows you to work with a directory tree that isn't fully populated,
without making diff-cache say that all the files are gone.
2005-05-05 09:31:09 -07:00
Kay Sievers
8ae0a8c514 [PATCH] git and symlinks as tracked content
Allow to store and track symlink in the repository. A symlink is stored
the same way as a regular file, only with the appropriate mode bits set.
The symlink target is therefore stored in a blob object.
This will hopefully make our udev repository fully functional. :)

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-05 08:23:01 -07:00
Anton Altaparmakov
5210372fe4 [PATCH] Fix git rpush.
Following up from my fix to rpull, please also apply this, which fixes
rpush.c to call git-rpull rather than rpull which no longer exists after
the Big Rename(TM)...

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-05 07:36:54 -07:00
Anton Altaparmakov
2af87aae78 [PATCH] Fix git rpull.
This fixes rpull.c to call git-rpush rather than rpush which no longer
exists after the Big Rename(TM)...

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-05 07:36:54 -07:00
Linus Torvalds
4bea3b6926 git-pull-script: do the diffstat also for the fast-forward case
This way you always see what the state change was.
2005-05-05 02:21:42 -07:00
Linus Torvalds
d0d0d0bd3c Merge http://members.cox.net/junkio/git-jc.git/ 2005-05-04 18:18:40 -07:00
Linus Torvalds
4feb7a016a Make "git-prune-script" take all refs into account.
This avoids pruning the kernel v2.6.11 tree that now has a tag.
2005-05-04 17:26:41 -07:00
Linus Torvalds
770896e548 Teach fsck-cache to accept non-commits for reachability analysis.
In particular, teach it about tags. Also, to make reachability actually
work for tags, we need to add the ref to the tagged object.
2005-05-04 17:03:09 -07:00
Linus Torvalds
552e2bd12e Teach "git-pull-script" about alternate HEAD's to pull..
People are already starting to use a multi-head model.
2005-05-04 17:02:16 -07:00
Sergey Vlasov
13019d4136 [PATCH] Fix memory leaks in git-fsck-cache
This patch fixes memory leaks in parse_object() and related functions;
these leaks were very noticeable when running git-fsck-cache.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-04 10:58:15 -07:00
Junio C Hamano
8a9d32b7e9 When the patch tries to create a new file and the file exists, abort.
This fixes an error introduced to git-apply-patch-script in the previous
round.  We do not invoke patch for create/delete case, so we need to
be a bit careful about detecting conflicts like this.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-04 10:45:36 -07:00
Linus Torvalds
705acc5c94 git-pull-script: add a final "diffstat" to show the result of the merge.
This is useful to verify that you got the right thing.
2005-05-04 07:12:18 -07:00
Junio C Hamano
b46f0b6dfd Optimize diff-cache -p --cached
This patch optimizes "diff-cache -p --cached" by avoiding to
inflate blobs into temporary files when the blob recorded in the
cache matches the corresponding file in the work tree.  The file
in the work tree is passed as the comparison source in such a
case instead.

This optimization kicks in only when we have already read the
cache this optimization and this is deliberate.  Especially,
diff-tree does not use this code, because changes are contained
in small number of files relative to the project size most of
the time, and reading cache is so expensive for a large project
that the cost of reading it outweighs the savings by not
inflating blobs.

Also this patch cleans up the structure passed from diff clients
by removing one unused structure member.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-04 01:45:24 -07:00
Junio C Hamano
6fa28064b0 Terminate diff-* on non-zero exit from GIT_EXTERNAL_DIFF
(slightly updated from the version posted to the GIT mailing list
with small bugfixes).

This patch changes the git-apply-patch-script to exit non-zero when
the patch cannot be applied.  Previously, the external diff driver
deliberately ignored the exit status of GIT_EXTERNAL_DIFF command,
which was a design mistake.  It now stops the processing when
GIT_EXTERNAL_DIFF exits non-zero, so the damages from running
git-diff-* with git-apply-patch-script between two wrong trees can be
contained.

The "diff" command line generated by the built-in driver is changed to
always exit 0 in order to match this new behaviour.  I know Pasky does
not use GIT_EXTERNAL_DIFF yet, so this change should not break Cogito,
either.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-04 01:38:06 -07:00
Junio C Hamano
ae7c0c92c0 Git-prune-script loses blobs referenced from an uncommitted cache.
(updated from the version posted to GIT mailing list).

When a new blob is registered with update-cache, and before the cache
is written as a tree and committed, git-fsck-cache will find the blob
unreachable.  This patch adds a new flag, "--cache" to git-fsck-cache,
with which it keeps such blobs from considered "unreachable".

The git-prune-script is updated to use this new flag.  At the same time
it adds .git/refs/*/* to the set of default locations to look for heads,
which should be consistent with expectations from Cogito users.

Without this fix, "diff-cache -p --cached" after git-prune-script has
pruned the blob object will fail mysteriously and git-write-tree would
also fail.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-04 01:33:33 -07:00
Junio C Hamano
fd0ffd3ad1 Short-cut error return path in git-local-pull.
When git-local-pull with -l option gets ENOENT attempting to create
a hard link, there is no point falling back to other copy methods.
With this patch, git-local-pull detects such a case and gives up
copying the file early.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-04 01:28:45 -07:00
Junio C Hamano
b2d62f161e Make git-*-pull say who wants them for missing objects.
This patch updates pull.c, the engine that decides which objects are
needed, given a commit to traverse from, to report which commit was
calling for the object that cannot be retrieved from the remote side.
This complements git-fsck-cache in that it checks the consistency of
the remote repository for reachability.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-04 01:26:24 -07:00
Linus Torvalds
a31c6d022e sha1_file: make the new sha1 object writing be coda-friendly.
Coda doesn't like cross-directory hardlinks. So try to fall back
on a plain rename instead.
2005-05-03 15:16:18 -07:00
Linus Torvalds
aac1794132 Improve sha1 object file writing.
Make it much safer: we write to a temporary file, and then link that
temporary file to the final destination. This avoids all the nasty
races if several people write the same object at the same time.

It should also result in nicer on-disk layout, since it means that
objects all get created in the same subdirectory. That makes a lot
of block allocation algorithms happier, since the objects will now
be allocated from the same zone.
2005-05-03 11:46:16 -07:00
Linus Torvalds
92d4c85d24 fsck-cache: fix SIGSEGV on bad tag object
fsck_tag() failes to notice that the parsing of the tag may
have failed in the parse_object() call on the object that it
is tagging. 

Noticed by Junio.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-03 07:57:56 -07:00
Linus Torvalds
54c26fb9d0 Automatic merge of /home/torvalds/junkio/.git/ 2005-05-03 07:30:10 -07:00
Linus Torvalds
aa03413467 fsck-cache: report broken links correctly
We reported the type of te missing object incorrectly: we reported it as
the type of the referrer object, not the object that was referred to.
2005-05-02 21:10:54 -07:00
Linus Torvalds
8500349208 Make fsck-cache do better tree checking.
We check the ordering of the entries, and we verify that none
of the entries has a slash in it (this allows us to remove the
hacky "has_full_path" member from the tree structure, since we
now just test it by walking the tree entries instead).
2005-05-02 16:13:18 -07:00
tony.luck@intel.com
f220fb6b84 [PATCH] Fix warning in convert-cache
gcc 3.4.3 kicks out this warning:
convert-cache.c: In function `write_subdirectory':
convert-cache.c:102: warning: field precision is not type int (arg 4)

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-02 14:56:39 -07:00
Linus Torvalds
7e8c174a97 fsck-cache: sort entries by inode number
This improves the cold-cache behaviour on most filesystems,
since it makes the fsck access patterns more regular on
the disk, rather than seeking back and forth.

Note the "most". Not all filesystems have any relationship
between inode number and location on disk.
2005-05-02 09:06:33 -07:00
Junio C Hamano
ee28152d03 Update git-merge-one-file-script.
With this change, git-merge-one-file-script ceases to smudge
files in the work tree when recording the trivial merge results
(conflicting auto-merge failure case does not touch the work
tree file as before).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-01 23:53:32 -07:00
Junio C Hamano
0ff5bf7cfc Implement git-update-cache --force-remove <path>
This new flag tells git-update-cache to remove the named path even
when the work tree still happens to have the file.  It is used to
update git-merge-one-file-script not to smudge the work tree.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-01 23:50:51 -07:00
Junio C Hamano
74400e7175 Add git-write-blob.
A new command, git-write-blob, is introduced.  This registers
the contents of any file on the filesystem as a blob in the
object database and reports its SHA1 to the standard output.
To implement it, the patch promotes index_fd() from a static
function in update-cache.c to extern and moves it to a library
source, sha1_file.c.

This command is used to update git-merge-one-file-script so that
it does not smudge the work tree.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-01 23:45:49 -07:00
Junio C Hamano
285bf834be Make git-apply-patch-script executable. 2005-05-01 23:17:28 -07:00
Linus Torvalds
0980d9b3a5 Change the prefix for builtin diff generation.
It's silly, and it shouldn't matter, but every time I look at
the diffs, I ended up just worrying why "l/" and "k/" as the
prefixes.

Junio says it's a tribute to linux-kernel, but graciously also
said I can change it to something else. So make it "a/" and "b/"
until somebody else complains ;)
2005-05-01 21:53:36 -07:00
Linus Torvalds
62c1f6b4af Get AUTHOR_DATE from the email Date: line
Now that git does pretty reliable date parsing, we might as well get
the date from the email itself. Of course, it's still questionable
whether the date on the email is all that relevant, but it's certainly
no worse than taking the commit date.
2005-05-01 21:42:53 -07:00
Alexey Nezhdanov
bab5583a49 [PATCH] git-export complains about mising cat-file
Fixes bits leaved during name change.

Signed-off-by: Alexey Nezhdanov <snake@penza-gsm.ru>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-01 21:23:04 -07:00
Junio C Hamano
b02a26cb87 [PATCH] git-local-pull updates
This is to be applied on top of the previous patch to add
git-local-pull command.  In addition to the '-l' (attempt
hardlink before anything else) and the '-s' (then attempt
symlink) flags, it adds '-n' (do not fall back to file copy)
flag.  Also it updates the comments.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-01 21:10:04 -07:00
Junio C Hamano
7fa76eeb75 [PATCH] typo fixes to git-apply-patch-script
When git-apply-patch-script creates a new file without
executable mode set, a typo caused it not to report that
activity to the user.  Also it was mistakenly running
git-update-cache twice for newly created or deleted paths.  This
patch fixes these problems.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-01 21:09:28 -07:00
Junio C Hamano
dfcb405799 [PATCH] Add git-local-pull.
This adds the git-local-pull command as a smaller brother of
http-pull and rpull.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-01 21:09:28 -07:00
Junio C Hamano
ee4f439fea [PATCH] Do not call fetch() when we have it.
Currently pull() calls fetch() without checking whether we have
the wanted object but all of the existing fetch()
implementations perform this check and return success
themselves.  This patch moves the check to the caller.

I will be sending a trivial git-local-pull which depends on
this in the next message.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-01 21:07:40 -07:00
Junio C Hamano
90535218dd [PATCH] Make git-update-cache --refresh fail if update/merge needed.
Scripts may find it useful if they do not have to parse the
output from the command but just can rely on its exit status.

Earlier both Linus and myself thought this would be necessary to
make git-prune-script safer but it turns out that the issue was
somewhere else and not related to what this patch addresses.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-01 21:07:40 -07:00
Linus Torvalds
fa9e9c7bc4 Fix missing '\n' at end of git-cat-file -t output. 2005-05-01 19:40:39 -07:00
Linus Torvalds
11e7d5c594 Make "cat-file" use "read_object_with_reference()"
This means that you can take a tag object, and do

	git-cat-file commit tagname

and it will cat the commit that the tag points to. Or you can
cat the tree that a commit (or tag) points to.

It still gives the old behaviour if you just give it the
original type, ie if you want to see the tag object itself,
you'd do

	git-cat-file -t tagname

and you'd get the expected tag output.
2005-05-01 19:28:18 -07:00
Linus Torvalds
ca4c7db9ef Remove the ugly jit-style parent syntax.
If somebody wants it later, we can re-do it, but for now we consider
it an experiment that wasn't worth it. Git will still honor symbolic
names, it just won't look up parents for you.

Of course, you can always do it by hand if you want to.
2005-05-01 19:16:06 -07:00
Linus Torvalds
35ad33823e Add "look up parent" logic for the simple names.
It uses the jit syntax, at least for now. 0-xxxx is the first parent of xxxx,
while 1-xxxx is the second, and so on. You can use just "-xxxx" for the first
parent, but a lot of commands will think that the initial '-' implies a
command line flag.
2005-05-01 18:13:16 -07:00
Linus Torvalds
3c249c9506 Add "get_sha1()" helper function.
This allows the programs to use various simplified versions of
the SHA1 names, eg just say "HEAD" for the SHA1 pointed to by
the .git/HEAD file etc.

For example, this commit has been done with

	git-commit-tree $(git-write-tree) -p HEAD

instead of the traditional "$(cat .git/HEAD)" syntax.
2005-05-01 16:36:56 -07:00
Linus Torvalds
68849b5442 date handling: handle "AM"/"PM" on time
And be a bitmore careful about matching: if we don't recognize a word
or a number, we skip the whole thing, rather than trying the next character
in that word/number.

Finally: since ctime() adds the final '\n', don't add another one in test-date.
2005-05-01 12:34:56 -07:00