1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-06 09:13:01 +01:00
Commit graph

4789 commits

Author SHA1 Message Date
Junio C Hamano
9941afc051 Merge branch 'jc/lockfile'
* jc/lockfile:
  ref-log: style fixes.
  refs.c: convert it to use lockfile interface.
  Make index file locking code reusable to others.
2006-06-06 16:42:52 -07:00
Junio C Hamano
44fe4f522e Merge branch 'js/alias'
* js/alias:
  git alias: try alias last.
  If you have a config containing something like this:
2006-06-06 16:42:46 -07:00
Junio C Hamano
ad0e0b0a31 Merge branch 'vb/sendemail'
* vb/sendemail:
  send-email: a bit more careful domain regexp.
  send-email: be more lenient and just catch obvious mistakes.
  Cleanup git-send-email.perl:extract_valid_email
2006-06-06 16:42:33 -07:00
Robert Fitzsimons
3026402cbc builtin-grep: pass ignore case option to external grep
Don't just read the --ignore-case/-i option, pass the flag on to the
external grep program.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-06 16:22:45 -07:00
Junio C Hamano
e5f38ec3c5 ref-log: style fixes.
A few style fixes to get the code in line with the rest.

 - asterisk to make a type a pointer to something goes in front
   of the variable, not at the end of the base type.
   E.g. a pointer to an integer is "int *ip", not "int* ip".

 - open parenthesis for function parameter list, unlike
   syntactic constructs, comes immediately after the function
   name.  E.g. "if (foo) bar();" not "if(foo) bar ();".

 - "else" does not come on the same line as the closing brace of
   corresponding "if".

The style is mostly a matter of personal taste, and people may
disagree, but consistency is important.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-06 14:30:58 -07:00
Junio C Hamano
c33d5174d6 refs.c: convert it to use lockfile interface.
This updates the ref locking code to use creat-rename locking
code we use for the index file, so that it can borrow the code
to clean things up upon signals and program termination.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-06 14:30:58 -07:00
Junio C Hamano
021b6e4549 Make index file locking code reusable to others.
The framework to create lockfiles that are removed at exit is
first used to reliably write the index file, but it is
applicable to other things, so stop calling it "cache_file".

This also rewords a few remaining error message that called the
index file "cache file".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-06 14:30:58 -07:00
Junio C Hamano
dd8239f997 HTTP cleanup
This ifdef's out more functions that are not used while !USE_MULTI
in http code.  Also the dependency of http related objects on http.h
header file was missing in the Makefile.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-06 14:26:57 -07:00
Nick Hengeveld
b3ca4e4ebb HTTP cleanup
Fix broken build when USE_CURL_MULTI is not defined, as noted by Becky Bruce.

During cleanup, free header slist that was created during init, as noted
by Junio.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-06 14:18:00 -07:00
Junio C Hamano
efd0201684 git-format-patch: add --output-directory long option again
Additionally notices and complains to an -o option without
directory or a duplicated -o option, -o and --stdout given
together.  Also delays the creation of directory until all
arguments are parsed, so that the command does not leave an
empty directory behind when it exits after seeing an unrelated
invalid option.

[jc: originally from Dennis Stosberg but with minor fixes, and
 documentation updates from Dennis.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-06 14:16:43 -07:00
Junio C Hamano
09302e177e send-email: a bit more careful domain regexp.
This tightens the regexp a bit to make sure there is no double dots.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-06 14:12:46 -07:00
Junio C Hamano
ad9c18f504 send-email: be more lenient and just catch obvious mistakes.
This cleans up the pattern matching subroutine by introducing
two variables to hold regexp to approximately match local-part
and domain in the e-mail address.  It is meant to catch obvious
mistakes with a cheap check.

The patch also moves "scalar" to force Email::Valid->address()
to work in !wantarray environment to extract_valid_address;
earlier it was in the caller of the subroutine, which was way
too error prone.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-06 00:05:56 -07:00
Junio C Hamano
16cee38ae2 rev-parse: tighten constness properly.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-05 22:36:21 -07:00
Sean
1d84a60459 A Perforce importer for git.
Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-05 22:17:26 -07:00
Junio C Hamano
a025463bc0 git alias: try alias last.
This disables alias "foo" from being used for git-foo, and when
we do use alias we check the built-in and then existing command
names first and then alias as the fallback.  This avoids the
problem of common commands used in scripts getting clobbered by
user specific aliases.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-05 18:09:40 -07:00
Johannes Schindelin
2b11e3170e If you have a config containing something like this:
[alias]
		l = "log --stat -M ORIG_HEAD.."

you can call

	git l

and it will do the same as

	git log --stat -M ORIG_HEAD..

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-05 17:49:17 -07:00
Nick Hengeveld
441c823e89 builtin-push: don't pass --thin to HTTP transport
git-http-push does not currently use packs to transfer objects.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-05 17:39:44 -07:00
Linus Torvalds
ce0bd64299 pack-objects: improve path grouping heuristics.
This trivial patch not only simplifies the name hashing, it actually
improves packing for both git and the kernel.

The git archive pack shrinks from 6824090->6622627 bytes (a 3%
improvement), and the kernel pack shrinks from 108756213 to 108219021 (a
mere 0.5% improvement, but still, it's an improvement from making the
hashing much simpler!)

We just create a 32-bit hash, where we "age" previous characters by two
bits, so the last characters in a filename count most. So when we then
compare the hashes in the sort routine, filenames that end the same way
sort the same way.

It takes the subdirectory into account (unless the filename is > 16
characters), but files with the same name within the same subdirectory
will obviously sort closer than files in different subdirectories.

And, incidentally (which is why I tried the hash change in the first
place, of course) builtin-rev-list.c will sort fairly close to rev-list.c.

And no, it's not a "good hash" in the sense of being secure or unique, but
that's not what we're looking for. The whole "hash" thing is misnamed
here. It's not so much a hash as a "sorting number".

[jc: rolled in simplification for computing the sorting number
 computation for thin pack base objects]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-05 17:23:31 -07:00
Linus Torvalds
87cefaaff9 rev-list: fix process_tree() conversion.
The tree-walking conversion of the "process_tree()" function
broke packing by using an unrelated variable from outer scope.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-05 14:54:17 -07:00
Linus Torvalds
2befe6feb9 Fix typo in tutorial-2.txt
This should be obvious enough.

I didn't actually _test_ the tutorial, but if the old command worked,
something is really wrong!

Signed-off-by: Linus "Duh!" Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-05 13:05:49 -07:00
Horst H. von Brand
53bcf78a02 Fix Documentation/everyday.txt: Junio's workflow
The workflow for Junio was badly formatted.

Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-05 12:27:03 -07:00
Horst H. von Brand
c51901de1d Add example xinetd(8) configuration to Documentation/everyday.txt
Many Linux distributions use xinetd(8), not inetd(8).
Give a sample configuration file.

Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-05 12:26:59 -07:00
Linus Torvalds
eff97e3fae read-tree: fix eye-candy.
Anton Blanchard spotted that watching checkout stage of a clone
on a slow terminal takes ages because it forgot to clear the
"once a second happened" flag, so instead of updates the
percentage output for every file it checks out after the first
second has passed.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-05 12:26:53 -07:00
Aneesh Kumar K.V
4e2e5647f2 gitview: Add some useful keybindings.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-04 13:29:36 -07:00
Horst H. von Brand
e96fd30553 Cleanup git-send-email.perl:extract_valid_email
- Fix the regular expressions for local addresses
- Fix the fallback regexp for non-local addresses, simplify the logic

Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-04 00:00:20 -07:00
Junio C Hamano
16a4c6ee0d Merge branch 'lt/tree-2'
* lt/tree-2:
  fetch.c: do not call process_tree() from process_tree().
  tree_entry(): new tree-walking helper function
  adjust to the rebased series by Linus.
  Remove "tree->entries" tree-entry list from tree parser
  Switch "read_tree_recursive()" over to tree-walk functionality
  Make "tree_entry" have a SHA1 instead of a union of object pointers
  Add raw tree buffer info to "struct tree"
  Remove last vestiges of generic tree_entry_list
  Convert fetch.c: process_tree() to raw tree walker
  Convert "mark_tree_uninteresting()" to raw tree walker
  Remove unused "zeropad" entry from tree_list_entry
  fsck-objects: avoid unnecessary tree_entry_list usage
  Remove "tree->entries" tree-entry list from tree parser
  builtin-read-tree.c: avoid tree_entry_list in prime_cache_tree_rec()
  Switch "read_tree_recursive()" over to tree-walk functionality
  Make "tree_entry" have a SHA1 instead of a union of object pointers
  Make "struct tree" contain the pointer to the tree buffer
2006-06-03 23:59:27 -07:00
Junio C Hamano
f0679f474a Merge branch 'sp/reflog'
* sp/reflog:
  fetch.c: do not pass uninitialized lock to unlock_ref().
  Test that git-branch -l works.
  Verify git-commit provides a reflog message.
  Enable ref log creation in git checkout -b.
  Create/delete branch ref logs.
  Include ref log detail in commit, reset, etc.
  Change order of -m option to update-ref.
  Correct force_write bug in refs.c
  Change 'master@noon' syntax to 'master@{noon}'.
  Log ref updates made by fetch.
  Force writing ref if it doesn't exist.
  Added logs/ directory to repository layout.
  General ref log reading improvements.
  Fix ref log parsing so it works properly.
  Support 'master@2 hours ago' syntax
  Log ref updates to logs/refs/<ref>
  Convert update-ref to use ref_lock API.
  Improve abstraction of ref lock/write.
2006-06-03 23:59:03 -07:00
Junio C Hamano
731651fe25 Merge branch 'ff/svnimport'
* ff/svnimport:
  git-svnimport: Improved detection of merges.
2006-06-03 23:58:26 -07:00
Junio C Hamano
b0d6e64629 read-tree --reset: update working tree file for conflicted paths.
The earlier "git reset --hard" simplification stopped removing
leftover working tree files from a failed automerge, when
switching back to the HEAD version that does not have the
paths.

This patch, instead of removing the unmerged paths from the
index, drops them down to stage#0 but marks them with mode=0
(the same "to be deleted" marker we internally use for paths
deleted by the merge).  one_way_merge() function and the
functions it calls already know what to do with them -- if the
tree we are reading has the path the working tree file is
overwritten, and if it doesn't the working tree file is
removed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-03 23:57:41 -07:00
Junio C Hamano
bf41bf2db7 Merge branch 'jc/fmt-patch'
* jc/fmt-patch:
  Update documentation for git-format-patch
  format-patch: resurrect extra headers from config
  format-patch --signoff
2006-06-03 23:57:15 -07:00
Horst H. von Brand
abda1ef590 Documentation: Spelling fixes
Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-03 23:54:55 -07:00
Christian Couder
895f10c3b5 Builtin git-rev-parse.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-03 23:45:30 -07:00
Junio C Hamano
ea5aeb07e9 fetch: do not report "same" unless -verbose.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-03 23:44:40 -07:00
Junio C Hamano
2f164c35fa Merge branch 'ds/doc' into jc/fmt-patch
* ds/doc:
  Update documentation for git-format-patch
  sha1_file: avoid re-preparing duplicate packs
  handle concurrent pruning of packed objects
  http: prevent segfault during curl handle reuse
  Remove possible segfault in http-fetch.
  gitk: show_error fix
  [PATCH] gitk: start-up bugfix
  [PATCH] gitk: Replace "git-" commands with "git "
  [PATCH] gitk: Display commit messages with word wrap
  gitk: Fix bug where page-up/down wouldn't always work properly
  gitk: Fix display of "(...)" for parents/children we haven't drawn
  send-email: only 'require' instead of 'use' Net::SMTP
  Allow multiple -m options to git-commit.
2006-06-02 18:17:35 -07:00
Dennis Stosberg
2052d146f6 Update documentation for git-format-patch
[jc: adjusted for recently resurrected features]

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-02 18:17:08 -07:00
Junio C Hamano
6f9012b625 fetch.c: do not call process_tree() from process_tree().
This function reads a freshly fetched tree object, and schedules
the objects pointed by it for further fetching, so doing
lookup_tree() and process_tree() recursively from there does not
make much sense.  We need to use process() on it to make sure we
fetch it first, and leave the recursive processing to later
stages.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-02 15:23:47 -07:00
Jeff King
86f7780c0b sha1_file: avoid re-preparing duplicate packs
When adding packs, skip the pack if we already have it in the packed_git
list. This might happen if we are re-preparing our packs because of a
missing object.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-02 11:09:44 -07:00
Jeff King
637cdd9d1d handle concurrent pruning of packed objects
This patch causes read_sha1_file and sha1_object_info to re-examine the
list of packs if an object cannot be found. It works by re-running
prepare_packed_git() after an object fails to be found.

It does not attempt to clean up the old pack list. Old packs which are in
use can continue to be used (until unused by lru selection).  New packs
are placed at the front of the list and will thus be examined before old
packs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-02 11:09:38 -07:00
Junio C Hamano
3126262710 Merge branch 'nh/http'
* nh/http:
  http: prevent segfault during curl handle reuse
  Remove possible segfault in http-fetch.
2006-06-02 10:31:15 -07:00
Johannes Schindelin
20ff06805c format-patch: resurrect extra headers from config
Once again, if you have

	[format]
		headers = "Origamization: EvilEmpire\n"

format-patch will add these headers just after the "Subject:" line.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-02 07:30:55 -07:00
Junio C Hamano
0825de892f Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: show_error fix
  [PATCH] gitk: start-up bugfix
  [PATCH] gitk: Replace "git-" commands with "git "
  [PATCH] gitk: Display commit messages with word wrap
  gitk: Fix bug where page-up/down wouldn't always work properly
  gitk: Fix display of "(...)" for parents/children we haven't drawn
2006-05-31 22:27:26 -07:00
Nick Hengeveld
9094950d73 http: prevent segfault during curl handle reuse
If a curl handle is configured with special options, they may reference
information that is freed after the request is complete which can cause
a segfault if the curl handle is reused for a different type of request.

This patch resets these options to a safe state when a transfer slot is
assigned to a new request.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-31 18:24:05 -07:00
Johannes Schindelin
87840620fd send-email: only 'require' instead of 'use' Net::SMTP
This was proposed by Eric Wong and fixes the test. (Of course, git-send-email
does not work, if there is no Net::SMTP here, but it will say what is wrong
when you actually try to use send-email.)

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-31 16:17:15 -07:00
Shawn Pearce
6891281cfa Allow multiple -m options to git-commit.
I find it very convenient to be able to supply multiple paragraphs
of text on the command line with a single git-commit call.  This
change permits multiple -m/--message type options to be supplied
to git-commit with each message being added as its own paragraph
of text in the commit message.

The -m option is still not permitted with -c/-C/-F nor are multiple
occurrences of these options permitted.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-31 15:40:47 -07:00
Junio C Hamano
99bd0f5558 fetch.c: do not pass uninitialized lock to unlock_ref().
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-31 15:23:44 -07:00
Junio C Hamano
cf2251b604 format-patch --signoff
This resurrects --signoff option to format-patch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-31 15:11:49 -07:00
Florian Forster
65160b8b04 git-svnimport: Improved detection of merges.
The regexes detecting merges (while still relying on the commit messages,
though) have been improved to catch saner (and hopefully more) messages. The
old regex was so generic that it often matched something else and missed the
actual merge-message.
Also, the regex given with the `-M' commandline-option is checked first:
Explicitely given regexes should be considered better than the builtin ones,
and should therefore be given a chance to match a message first.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-31 14:22:28 -07:00
Shawn Pearce
1361fa3e49 Improved pack format documentation.
While trying to implement a pack reader in Java I was mislead by
some facts listed in this documentation as well as found a few
details to be missing about the pack header.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-30 23:09:02 -07:00
Linus Torvalds
4c068a9831 tree_entry(): new tree-walking helper function
This adds a "tree_entry()" function that combines the common operation of
doing a "tree_entry_extract()" + "update_tree_entry()".

It also has a simplified calling convention, designed for simple loops
that traverse over a whole tree: the arguments are pointers to the tree
descriptor and a name_entry structure to fill in, and it returns a boolean
"true" if there was an entry left to be gotten in the tree.

This allows tree traversal with

	struct tree_desc desc;
	struct name_entry entry;

	desc.buf = tree->buffer;
	desc.size = tree->size;
	while (tree_entry(&desc, &entry) {
		... use "entry.{path, sha1, mode, pathlen}" ...
	}

which is not only shorter than writing it out in full, it's hopefully less
error prone too.

[ It's actually a tad faster too - we don't need to recalculate the entry
  pathlength in both extract and update, but need to do it only once.
  Also, some callers can avoid doing a "strlen()" on the result, since
  it's returned as part of the name_entry structure.

  However, by now we're talking just 1% speedup on "git-rev-list --objects
  --all", and we're definitely at the point where tree walking is no
  longer the issue any more. ]

NOTE! Not everybody wants to use this new helper function, since some of
the tree walkers very much on purpose do the descriptor update separately
from the entry extraction. So the "extract + update" sequence still
remains as the core sequence, this is just a simplified interface.

We should probably add a silly two-line inline helper function for
initializing the descriptor from the "struct tree" too, just to cut down
on the noise from that common "desc" initializer.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-30 23:03:01 -07:00
Dmitry V. Levin
2b6016263c git_exec_path, execv_git_cmd: ignore empty environment variables
Ignoring empty environment variables is good common practice.
Ignoring --exec-path with empty argument won't harm, too:
if user means current directory, there is a "--exec-path=."

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-30 21:49:01 -07:00