Commit Graph

4998 Commits

Author SHA1 Message Date
Junio C Hamano
bf78d1a6cb Merge branch 'lt/dirwalk' into next
* lt/dirwalk:
  Add builtin "git rm" command
  Move pathspec matching from builtin-add.c into dir.c
2006-05-19 17:30:34 -07:00
Linus Torvalds
d9b814cc97 Add builtin "git rm" command
This changes semantics very subtly, because it adds a new atomicity
guarantee.

In particular, if you "git rm" several files, it will now do all or
nothing. The old shell-script really looped over the removed files one by
one, and would basically randomly fail in the middle if "-f" was used and
one of the files didn't exist in the working directory.

This C builtin one will not re-write the index after each remove, but
instead remove all files at once. However, that means that if "-f" is used
(to also force removal of the file from the working directory), and some
files have already been removed from the workspace, it won't stop in the
middle in some half-way state like the old one did.

So what happens is that if the _first_ file fails to be removed with "-f",
we abort the whole "git rm". But once we've started removing, we don't
leave anything half done. If some of the other files don't exist, we'll
just ignore errors of removal from the working tree.

This is only an issue with "-f", of course.

I think the new behaviour is strictly an improvement, but perhaps more
importantly, it is _different_. As a special case, the semantics are
identical for the single-file case (which is the only one our test-suite
seems to test).

The other question is what to do with leading directories. The old "git
rm" script didn't do anything, which is somewhat inconsistent. This one
will actually clean up directories that have become empty as a result of
removing the last file, but maybe we want to have a flag to decide the
behaviour?

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 17:28:33 -07:00
Junio C Hamano
7c4f59d181 Fix build procedure for builtin-init-db
c3c8835fbb broke the default template
location which is in builtin-init-db.o, by not supplying the
compilation-time constant to the right build commands.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 17:23:07 -07:00
Junio C Hamano
0081e36c9d Merge branch 'jc/read-tree-safety'
* jc/read-tree-safety:
  read-tree -m -u: do not overwrite or remove untracked working tree files.
2006-05-19 17:02:22 -07:00
Junio C Hamano
edd5cc2428 Merge branch 'jc/apply'
* jc/apply:
  apply --cached: do not check newly added file in the working tree
2006-05-19 16:59:29 -07:00
Paul Mackerras
6d80f3ce78 Merge branch 'master' into new 2006-05-20 09:59:10 +10:00
Paul Mackerras
e72ee5ebc8 gitk: Fix bug where page-up/down wouldn't always work properly
If the user pressed page up or page down and the new page wasn't
already drawn, we failed to select the line we wanted in the new
page.  This fixes it.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-05-20 09:58:49 +10:00
Junio C Hamano
667661d46e Merge branch 'eb/quilt'
* eb/quilt:
  Implement a --dry-run option to git-quiltimport
  Implement git-quiltimport
2006-05-19 16:57:11 -07:00
Junio C Hamano
12bb2035e9 Merge branch 'jc/grep'
* jc/grep:
  Revert "builtin-grep: workaround for non GNU grep."
  builtin-grep: workaround for non GNU grep.
2006-05-19 16:55:33 -07:00
Paul Mackerras
908c35850a gitk: Make a row of controls for controlling highlighting
Now there is a bar across the middle (just below the bar containing
the sha1 ID, find string etc.) which controls highlighting.  There are
three ways to highlight: the user can highlight commits affecting
a list of paths, commits in a view, or commits where the author or
committer matches any of a list of strings (case-insensitive).  The
elements of the list of paths and list of names are delimited by
whitespace with shell quoting rules.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-05-20 09:38:11 +10:00
Junio C Hamano
9463ed0d73 Merge branch 'lt/grep'
* lt/grep:
  builtin-grep: workaround for non GNU grep.
  git-am: use apply --cached
  apply --cached: apply a patch without using working tree.
  apply --numstat: show new name, not old name.
2006-05-19 16:26:45 -07:00
Junio C Hamano
3532998f40 Merge branch 'ts/doctar'
* ts/doctar:
  Documentation/Makefile: create tarballs for the man pages and html files
2006-05-19 16:26:01 -07:00
Sean
582af68815 Allow pickaxe and diff-filter options to be used by git log.
Handle the -S option when passed to git log such that only the
appropriate commits are displayed.  Also per Junio's comments, do
the same for "--diff-filter", so that it too can be used as an option
to git log.  By default no patch or diff information is displayed.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 16:24:51 -07:00
Linus Torvalds
3c6a370b0e Move pathspec matching from builtin-add.c into dir.c
I'll use it for builtin-rm.c too.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 16:14:50 -07:00
Linus Torvalds
405e5b2fe0 Libify the index refresh logic
This cleans up and libifies the "git update-index --[really-]refresh"
functionality. This will be eventually required for eventually doing the
"commit" and "status" commands as built-ins.

It really just moves "refresh_index()" from update-index.c to
read-cache.c, but it also has to change the calling convention so that the
function uses a "unsigned int flags" argument instead of various static
flags variables for passing down the information about whether to be quiet
or not, and allow unmerged entries etc.

That actually cleans up update-index.c too, since it turns out that all
those flags were really specific to that one function of the index update,
so they shouldn't have had file-scope visibility even before.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:59:18 -07:00
Timo Hirvonen
c3c8835fbb Builtin git-init-db
Basically this just renames init-db.c to builtin-init-db.c and makes
some strings const.

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:31:20 -07:00
Junio C Hamano
6858d49492 Merge part of 'js/fmt-patch' for RFC2822 dates into 'sp/reflog'
An earlier patch from Shawn Pearce dependes on a change that is
only in "next".  I do not want to make this series hostage to
the yet-to-graduate js/fmt-patch branch, but let's try fixing it
by merging the early parts of the branch to see what happens.

Right now, 'sp/reflog' will not be in "next" for now, so I won't
have to regret this -- if this merge causes problem down the road
merging I can always rebuild the topic branch ;-).
2006-05-19 15:25:57 -07:00
Shawn Pearce
969d326d6b Enable ref log creation in git checkout -b.
Switch git checkout -b to use git-update-ref rather than echo and
a shell I/O redirection.  This is more in line with typical GIT
commands and allows -b to be logged according to the normal ref
logging rules.

Added -l option to allow users to create the ref log at the same
time as creating a branch.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:03:39 -07:00
Shawn Pearce
3a4b3f269c Create/delete branch ref logs.
When crating a new branch offer '-l' as a way for the user to
quickly enable ref logging for the new branch.

When deleting a branch also delete its ref log.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:03:24 -07:00
Shawn Pearce
67644a4d77 Include ref log detail in commit, reset, etc.
When updating a ref at the direction of the user include a reason why
head was changed as part of the ref log (assuming it was enabled).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:03:21 -07:00
Shawn Pearce
7792cc2fa1 Change order of -m option to update-ref.
The actual position doesn't matter but most people prefer to see
options appear before the arguments.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:03:10 -07:00
Shawn Pearce
8fe92775f3 Correct force_write bug in refs.c
My earlier attempt at forcing a write for non-existant refs worked;
it forced a write for pretty much all refs.  This corrects the
condition to only force a write for refs which don't exist yet.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:02:59 -07:00
Shawn Pearce
cce91a2cae Change 'master@noon' syntax to 'master@{noon}'.
Its ambiguous to parse "master@2006-05-17 18:30:foo" when foo is
meant as a file name and ":30" is meant as 30 minutes past 6 pm.
Therefore all date specifications in a sha1 expression must now
appear within brackets and the ':' splitter used for the path name
in a sha1 expression ignores ':' appearing within brackets.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:02:55 -07:00
Shawn Pearce
d0740d92be Log ref updates made by fetch.
If a ref is changed by http-fetch, local-fetch or ssh-fetch
record the change and the remote URL/name in the log for the ref.
This requires loading the config file to check logAllRefUpdates.

Also fixed a bug in the ref lock generation; the log file name was
not being produced right due to a bad prefix length.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:02:52 -07:00
Shawn Pearce
732232a123 Force writing ref if it doesn't exist.
Normally we try to skip writing a ref if its value hasn't changed
but in the special case that the ref doesn't exist but the new
value is going to be 0{40} then force writing the ref anyway.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:02:43 -07:00
Shawn Pearce
c22a7f0fb9 Added logs/ directory to repository layout.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:02:38 -07:00
Shawn Pearce
e52290428b General ref log reading improvements.
Corrected the log starting time displayed in the error message
(as it was always showing the epoch due to a bad input to strtoul).

Improved the log parser so we only scan backwards towards the
'\n' from the end of the prior log; during this scan the last '>'
is remembered to improve performance (rather than scanning forward
to it).

If the log record matched is the last log record in the file only
use its new sha1 value if the date matches exactly; otherwise we
leave the passed in sha1 alone as it already contains the current
value of the ref.  This way lookups of dates later than the log
end to stick with the current ref value in case the ref was updated
without logging.

If it looks like someone changed the ref without logging it and we
are going to return the sha1 which should have been valid during
the missing period then warn the user that there might be log data
missing and thus their query result may not be accurate.  The check
isn't perfect as its just based on comparing the old and new sha1
values between the two log records but its better than not checking
at all.

Implemented test cases based on git-rev-parse for most of the
boundary conditions.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:02:32 -07:00
Junio C Hamano
8090c08e1e Merge early part of 'sp/reflog' branch 2006-05-19 09:10:38 -07:00
Junio C Hamano
7723522a13 Merge branch 'eb/quilt' into next
* eb/quilt:
  Implement a --dry-run option to git-quiltimport
  Implement git-quiltimport
2006-05-18 22:56:43 -07:00
Eric W. Biederman
d3bd4ee1a5 Implement a --dry-run option to git-quiltimport
Since large quilt trees like -mm can easily have patches
without clear authorship information, add a --dry-run
option to make the problem patches easy to find.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-18 22:55:57 -07:00
Eric W. Biederman
d3d8f361a8 Implement git-quiltimport
Importing a quilt patch series into git is not very difficult
but parsing the patch descriptions and all of the other
minutia take a bit of effort to get right, so this automates it.

Since git and quilt complement each other it makes sense
to make it easy to go back and forth between the two.

If a patch is encountered that it cannot derive the author
from the user is asked.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-18 22:55:57 -07:00
Junio C Hamano
2c57ebc223 Merge branch 'ts/doctar' into next
* ts/doctar:
  Documentation/Makefile: create tarballs for the man pages and html files
  SubmittingPatches: The download location of External Editor has moved
  Make git-check-format-ref a builtin.
  Make "git rev-list" be a builtin
  builtin-diff: do not say files are renamed when blob and file are given
  Provide a way to flush git-diff-tree's output
2006-05-18 22:08:41 -07:00
Junio C Hamano
c7b345b075 Merge branch 'lt/dirwalk' into next
* lt/dirwalk:
  Prevent bogus paths from being added to the index.
2006-05-18 20:16:03 -07:00
Tilman Sauerbeck
52db0495dc Documentation/Makefile: create tarballs for the man pages and html files
[jc: rewrote by stealing from what I run to update html and
 man branches automatically]

Signed-off-by: Tilman Sauerbeck <tilman@code-monkey.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-18 20:15:45 -07:00
Lukas Sandström
ff62b7f378 SubmittingPatches: The download location of External Editor has moved
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-18 20:14:28 -07:00
Lukas Sandström
9370bae2ce Make git-check-format-ref a builtin.
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-18 15:51:38 -07:00
Linus Torvalds
5fb61b8dcf Make "git rev-list" be a builtin
This was surprisingly easy. The diff is truly minimal: rename "main()" to
"cmd_rev_list()" in rev-list.c, and rename the whole file to reflect its
new built-in status.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-18 15:46:11 -07:00
Junio C Hamano
065e0b126f builtin-diff: do not say files are renamed when blob and file are given
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-18 14:35:37 -07:00
Linus Torvalds
8dcf39c46e Prevent bogus paths from being added to the index.
With this one, it's now a fatal error to try to add a pathname
that cannot be added with "git add", i.e.

	[torvalds@g5 git]$ git add .git/config
	fatal: unable to add .git/config to index

and

	[torvalds@g5 git]$ git add foo/../bar
	fatal: unable to add foo/../bar to index

instead of the old "Ignoring path xyz" warning that would end up
silently succeeding on any other paths.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-18 12:07:31 -07:00
Junio C Hamano
fad6008385 Merge branch 'lt/dirwalk' into next
* lt/dirwalk:
  builtin-add: fix unmatched pathspec warnings.
2006-05-18 01:47:13 -07:00
Junio C Hamano
e8f990b4e4 builtin-add: fix unmatched pathspec warnings.
"git add Documentation/" when Documentation directory exists
does not barf (as it should not), but "git add ." barfed when it
did not add anything.  This was because we checked for the path
prefix ("Documentation/" in the former case, and an empty string
in the latter case) for existence, and lstat("", &st) would say
"Huh?".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-18 01:46:57 -07:00
Paul Mackerras
70f75cc96a Provide a way to flush git-diff-tree's output
Gitk wants to use git-diff-tree as a filter to tell it which ids from
a given list affect a set of files or directories.  We don't want to
fork and exec a new git-diff-tree process for each batch of ids, since
there could be a lot of relatively small batches.  For example, a
batch could contain as many ids as fit in gitk's headline display
window, i.e. 20 or so, and we would be processing a new batch every
time the user scrolls that window.

The --stdin flag to git-diff-tree is suitable for this, but the main
difficulty is that the output of git-diff-tree gets buffered and
doesn't get sent until the buffer is full.

This provides a way to get git-diff-tree to flush its output buffers.
If a blank line is supplied on git-diff-tree's standard input, it will
flush its output buffers and then accept further input.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-18 00:25:50 -07:00
Junio C Hamano
eab864a2c4 Merge branch 'master' into next
* master:
  git-cvsimport: Handle "Removed" from pserver
2006-05-17 23:37:51 -07:00
Junio C Hamano
18b01f4ff6 Merge branch 'maint'
* maint:
  git-cvsimport: Handle "Removed" from pserver
2006-05-17 22:33:06 -07:00
Elrond
be0c7e0697 git-cvsimport: Handle "Removed" from pserver
Sometimes the pserver says "Removed" instead of "Remove-entry".

Signed-off-by: Elrond <elrond+kernel.org@samba-tng.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-17 22:32:16 -07:00
Junio C Hamano
9c0f482361 Merge branch 'lt/dirwalk' into next
* lt/dirwalk:
  Remove old "git-add.sh" remnants
2006-05-17 22:27:58 -07:00
Linus Torvalds
c699f9b924 Remove old "git-add.sh" remnants
Repeat after me: "It's now a built-in"

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-17 22:27:42 -07:00
Shawn Pearce
70e34b2dc8 Fix ref log parsing so it works properly.
The log parser was only ever matching the last log record due to
calling strtoul on "> 1136091609" rather than " 1136091609".  Also
once a match for '@' has been found after the name of the ref there
is no point in looking for another '@' within the remaining text.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-17 17:36:36 -07:00
Shawn Pearce
d556fae2c0 Support 'master@2 hours ago' syntax
Extended sha1 expressions may now include date specifications
which indicate a point in time within the local repository's
history.  If the ref indicated to the left of '@' has a log in
$GIT_DIR/logs/<ref> then the value of the ref at the time indicated
by the specification is obtained from the ref's log.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-17 17:36:36 -07:00
Shawn Pearce
6de08ae688 Log ref updates to logs/refs/<ref>
If config parameter core.logAllRefUpdates is true or the log
file already exists then append a line to ".git/logs/refs/<ref>"
whenever git-update-ref <ref> is executed.  Each log line contains
the following information:

  oldsha1 <SP> newsha1 <SP> committer <LF>

where committer is the current user, date, time and timezone in
the standard GIT ident format.  If the caller is unable to append
to the log file then git-update-ref will fail without updating <ref>.

An optional message may be included in the log line with the -m flag.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-17 17:36:36 -07:00