--- /dev/null
+A short git tools survey
+========================
+
+
+Introduction
+------------
+
+Apart from git contrib/ area there are some others third-party tools
+you may want to look.
+
+This document presents a brief summary of each tool and the corresponding
+link.
+
+
+Alternative/Augmentative Procelains
+-----------------------------------
+
+ - *Cogito* (http://www.kernel.org/pub/software/scm/cogito/)
+
+ Cogito is a version control system layered on top of the git tree history
+ storage system. It aims at seamless user interface and ease of use,
+ providing generally smoother user experience than the "raw" Core GIT
+ itself and indeed many other version control systems.
+
+
+ - *pg* (http://www.spearce.org/category/projects/scm/pg/)
+
+ pg is a shell script wrapper around GIT to help the user manage a set of
+ patches to files. pg is somewhat like quilt or StGIT, but it does have a
+ slightly different feature set.
+
+
+ - *StGit* (http://www.procode.org/stgit/)
+
+ Stacked GIT provides a quilt-like patch management functionality in the
+ GIT environment. You can easily manage your patches in the scope of GIT
+ until they get merged upstream.
+
+
+History Viewers
+---------------
+
+ - *gitk* (shipped with git-core)
+
+ gitk is a simple TK GUI for browsing history of GIT repositories easily.
+
+
+ - *gitview* (contrib/)
+
+ gitview is a GTK based repository browser for git
+
+
+ - *gitweb* (ftp://ftp.kernel.org/pub/software/scm/gitweb/)
+
+ GITweb provides full-fledged web interface for GIT repositories.
+
+
+ - *qgit* (http://digilander.libero.it/mcostalba/)
+
+ QGit is a git/StGIT GUI viewer built on Qt/C++. QGit could be used
+ to browse history and directory tree, view annotated files, commit
+ changes cherry picking single files or applying patches.
+ Currently it is the fastest and most feature rich among the git
+ viewers and commit tools.
+
+
+
+Foreign SCM interface
+---------------------
+
+ - *git-svn* (contrib/)
+
+ git-svn is a simple conduit for changesets between a single Subversion
+ branch and git.
+
+
+ - *quilt2git / git2quilt* (http://home-tj.org/wiki/index.php/Misc)
+
+ These utilities convert patch series in a quilt repository and commit
+ series in git back and forth.
+
+
+Others
+------
+
+ - *(h)gct* (http://www.cyd.liu.se/users/~freku045/gct/)
+
+ Commit Tool or (h)gct is a GUI enabled commit tool for git and
+ Mercurial (hg). It allows the user to view diffs, select which files
+ to committed (or ignored / reverted) write commit messages and
+ perform the commit itself.
+
+ - *git.el* (contrib/)
+
+ This is an Emacs interface for git. The user interface is modeled on
+ pcl-cvs. It has been developed on Emacs 21 and will probably need some
+ tweaking to work on XEmacs.
* The delta-parsing part is almost straight copy of patch-delta.c
* which is (C) 2005 Nicolas Pitre <nico@cam.org>.
*/
-#include "cache.h"
-#include "delta.h"
-#include "count-delta.h"
#include <stdlib.h>
#include <string.h>
#include <limits.h>
-
-struct span {
- struct span *next;
- unsigned long ofs;
- unsigned long end;
-};
-
-static void touch_range(struct span **span,
- unsigned long ofs, unsigned long end)
-{
- struct span *e = *span;
- struct span *p = NULL;
-
- while (e && e->ofs <= ofs) {
- again:
- if (ofs < e->end) {
- while (e->end < end) {
- if (e->next && e->next->ofs <= end) {
- e->end = e->next->ofs;
- e = e->next;
- }
- else {
- e->end = end;
- return;
- }
- }
- return;
- }
- p = e;
- e = e->next;
- }
- if (e && e->ofs <= end) {
- e->ofs = ofs;
- goto again;
- }
- else {
- e = xmalloc(sizeof(*e));
- e->ofs = ofs;
- e->end = end;
- if (p) {
- e->next = p->next;
- p->next = e;
- }
- else {
- e->next = *span;
- *span = e;
- }
- }
-}
-
-static unsigned long count_range(struct span *s)
-{
- struct span *t;
- unsigned long sz = 0;
- while (s) {
- t = s;
- sz += s->end - s->ofs;
- s = s->next;
- free(t);
- }
- return sz;
-}
+#include "delta.h"
+#include "count-delta.h"
/*
* NOTE. We do not _interpret_ delta fully. As an approximation, we
int count_delta(void *delta_buf, unsigned long delta_size,
unsigned long *src_copied, unsigned long *literal_added)
{
- unsigned long added_literal;
+ unsigned long copied_from_source, added_literal;
const unsigned char *data, *top;
unsigned char cmd;
unsigned long src_size, dst_size, out;
- struct span *span = NULL;
if (delta_size < DELTA_SIZE_MIN)
return -1;
src_size = get_delta_hdr_size(&data);
dst_size = get_delta_hdr_size(&data);
- added_literal = out = 0;
+ added_literal = copied_from_source = out = 0;
while (data < top) {
cmd = *data++;
if (cmd & 0x80) {
if (cmd & 0x40) cp_size |= (*data++ << 16);
if (cp_size == 0) cp_size = 0x10000;
- touch_range(&span, cp_off, cp_off+cp_size);
+ copied_from_source += cp_size;
out += cp_size;
} else {
/* write literal into dst */
}
}
- *src_copied = count_range(span);
-
/* sanity check */
if (data != top || out != dst_size)
return -1;
/* delete size is what was _not_ copied from source.
* edit size is that and literal additions.
*/
+ *src_copied = copied_from_source;
*literal_added = added_literal;
return 0;
}
/* handling of delta buffers */
extern void *diff_delta(void *from_buf, unsigned long from_size,
void *to_buf, unsigned long to_size,
- unsigned long *delta_size, unsigned long max_size,
- void **from_index);
+ unsigned long *delta_size, unsigned long max_size);
extern void *patch_delta(void *src_buf, unsigned long src_size,
void *delta_buf, unsigned long delta_size,
unsigned long *dst_size);
#include <stdlib.h>
#include <string.h>
+#include <zlib.h>
#include "delta.h"
+/* block size: min = 16, max = 64k, power of 2 */
+#define BLK_SIZE 16
+
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+#define GR_PRIME 0x9e370001
+#define HASH(v, shift) (((unsigned int)(v) * GR_PRIME) >> (shift))
+
struct index {
const unsigned char *ptr;
+ unsigned int val;
struct index *next;
};
static struct index ** delta_index(const unsigned char *buf,
unsigned long bufsize,
- unsigned long trg_bufsize)
+ unsigned int *hash_shift)
{
- unsigned long hsize;
- unsigned int i, hshift, hlimit, *hash_count;
+ unsigned int hsize, hshift, entries, blksize, i;
const unsigned char *data;
struct index *entry, **hash;
void *mem;
/* determine index hash size */
- hsize = bufsize / 4;
- for (i = 8; (1 << i) < hsize && i < 24; i += 2);
+ entries = (bufsize + BLK_SIZE - 1) / BLK_SIZE;
+ hsize = entries / 4;
+ for (i = 4; (1 << i) < hsize && i < 16; i++);
hsize = 1 << i;
- hshift = (i - 8) / 2;
+ hshift = 32 - i;
+ *hash_shift = hshift;
- /*
- * Allocate lookup index. Note the first hash pointer
- * is used to store the hash shift value.
- */
- mem = malloc((1 + hsize) * sizeof(*hash) + bufsize * sizeof(*entry));
+ /* allocate lookup index */
+ mem = malloc(hsize * sizeof(*hash) + entries * sizeof(*entry));
if (!mem)
return NULL;
hash = mem;
- *hash++ = (void *)hshift;
- entry = mem + (1 + hsize) * sizeof(*hash);
+ entry = mem + hsize * sizeof(*hash);
memset(hash, 0, hsize * sizeof(*hash));
- /* allocate an array to count hash entries */
- hash_count = calloc(hsize, sizeof(*hash_count));
- if (!hash_count) {
- free(hash);
- return NULL;
- }
-
- /* then populate the index */
- data = buf + bufsize - 2;
- while (data > buf) {
- entry->ptr = --data;
- i = data[0] ^ ((data[1] ^ (data[2] << hshift)) << hshift);
+ /* then populate it */
+ data = buf + entries * BLK_SIZE - BLK_SIZE;
+ blksize = bufsize - (data - buf);
+ while (data >= buf) {
+ unsigned int val = adler32(0, data, blksize);
+ i = HASH(val, hshift);
+ entry->ptr = data;
+ entry->val = val;
entry->next = hash[i];
hash[i] = entry++;
- hash_count[i]++;
+ blksize = BLK_SIZE;
+ data -= BLK_SIZE;
}
- /*
- * Determine a limit on the number of entries in the same hash
- * bucket. This guard us against patological data sets causing
- * really bad hash distribution with most entries in the same hash
- * bucket that would bring us to O(m*n) computing costs (m and n
- * corresponding to reference and target buffer sizes).
- *
- * The more the target buffer is large, the more it is important to
- * have small entry lists for each hash buckets. With such a limit
- * the cost is bounded to something more like O(m+n).
- */
- hlimit = (1 << 26) / trg_bufsize;
- if (hlimit < 16)
- hlimit = 16;
-
- /*
- * Now make sure none of the hash buckets has more entries than
- * we're willing to test. Otherwise we cull the entry list to
- * limit identical three byte prefixes to still preserve a good
- * repartition across the reference buffer.
- */
- for (i = 0; i < hsize; i++) {
- struct index **list, *bucket, *remaining;
- int cnt;
- if (hash_count[i] < hlimit)
- continue;
-
- bucket = NULL;
- list = &bucket;
- remaining = hash[i];
- cnt = 0;
- while (cnt < hlimit && remaining) {
- struct index *this = remaining, *that;
- remaining = remaining->next;
- for (that = bucket; that; that = that->next) {
- if (!memcmp(that->ptr, this->ptr, 3))
- break;
- }
- if (that)
- continue; /* discard */
- cnt++;
- *list = this;
- list = &(this->next);
- this->next = NULL;
- }
- hash[i] = bucket;
- }
- free(hash_count);
-
- return hash-1;
+ return hash;
}
/* provide the size of the copy opcode given the block offset and size */
void *diff_delta(void *from_buf, unsigned long from_size,
void *to_buf, unsigned long to_size,
unsigned long *delta_size,
- unsigned long max_size,
- void **from_index)
+ unsigned long max_size)
{
unsigned int i, outpos, outsize, inscnt, hash_shift;
const unsigned char *ref_data, *ref_top, *data, *top;
if (!from_size || !to_size)
return NULL;
- if (from_index && *from_index) {
- hash = *from_index;
- } else {
- hash = delta_index(from_buf, from_size, to_size);
- if (!hash)
- return NULL;
- if (from_index)
- *from_index = hash;
- }
- hash_shift = (unsigned int)(*hash++);
+ hash = delta_index(from_buf, from_size, &hash_shift);
+ if (!hash)
+ return NULL;
outpos = 0;
outsize = 8192;
outsize = max_size + MAX_OP_SIZE + 1;
out = malloc(outsize);
if (!out) {
- if (!from_index)
- free(hash-1);
+ free(hash);
return NULL;
}
while (data < top) {
unsigned int moff = 0, msize = 0;
- if (data + 3 <= top) {
- i = data[0] ^ ((data[1] ^ (data[2] << hash_shift)) << hash_shift);
- for (entry = hash[i]; entry; entry = entry->next) {
- const unsigned char *ref = entry->ptr;
- const unsigned char *src = data;
- unsigned int ref_size = ref_top - ref;
- if (ref_size > top - src)
- ref_size = top - src;
- if (ref_size > 0x10000)
- ref_size = 0x10000;
- if (ref_size <= msize)
+ unsigned int blksize = MIN(top - data, BLK_SIZE);
+ unsigned int val = adler32(0, data, blksize);
+ i = HASH(val, hash_shift);
+ for (entry = hash[i]; entry; entry = entry->next) {
+ const unsigned char *ref = entry->ptr;
+ const unsigned char *src = data;
+ unsigned int ref_size = ref_top - ref;
+ if (entry->val != val)
+ continue;
+ if (ref_size > top - src)
+ ref_size = top - src;
+ while (ref_size && *src++ == *ref) {
+ ref++;
+ ref_size--;
+ }
+ ref_size = ref - entry->ptr;
+ if (ref_size > msize) {
+ /* this is our best match so far */
+ moff = entry->ptr - ref_data;
+ msize = ref_size;
+ if (msize >= 0x10000) {
+ msize = 0x10000;
break;
- if (*ref != *src)
- continue;
- while (ref_size-- && *++src == *++ref);
- if (msize < ref - entry->ptr) {
- /* this is our best match so far */
- msize = ref - entry->ptr;
- moff = entry->ptr - ref_data;
}
}
}
out = realloc(out, outsize);
if (!out) {
free(tmp);
- if (!from_index)
- free(hash-1);
+ free(hash);
return NULL;
}
}
if (inscnt)
out[outpos - inscnt - 1] = inscnt;
- if (!from_index)
- free(hash-1);
+ free(hash);
*delta_size = outpos;
return out;
}
#define MAX_SCORE 60000.0
#define DEFAULT_RENAME_SCORE 30000 /* rename/copy similarity minimum (50%) */
#define DEFAULT_BREAK_SCORE 30000 /* minimum for break to happen (50%)*/
-#define DEFAULT_MERGE_SCORE 45000 /* maximum for break-merge to happen (75%)*/
+#define DEFAULT_MERGE_SCORE 48000 /* maximum for break-merge to happen (80%)*/
#define MINIMUM_BREAK_SIZE 400 /* do not break a file smaller than this */
my $TEMP_DIR = tempdir( CLEANUP => 1 );
$log->debug("Temporary directory is '$TEMP_DIR'");
+# if we are called with a pserver argument,
+# deal with the authentication cat before entereing the
+# main loop
+if (@ARGV && $ARGV[0] eq 'pserver') {
+ my $line = <STDIN>; chomp $line;
+ unless( $line eq 'BEGIN AUTH REQUEST') {
+ die "E Do not understand $line - expecting BEGIN AUTH REQUEST\n";
+ }
+ $line = <STDIN>; chomp $line;
+ req_Root('root', $line) # reuse Root
+ or die "E Invalid root $line \n";
+ $line = <STDIN>; chomp $line;
+ unless ($line eq 'anonymous') {
+ print "E Only anonymous user allowed via pserver\n";
+ print "I HATE YOU\n";
+ }
+ $line = <STDIN>; chomp $line; # validate the password?
+ $line = <STDIN>; chomp $line;
+ unless ($line eq 'END AUTH REQUEST') {
+ die "E Do not understand $line -- expecting END AUTH REQUEST\n";
+ }
+ print "I LOVE YOU\n";
+ # and now back to our regular programme...
+}
+
# Keep going until the client closes the connection
while (<STDIN>)
{
print "E the repo config file needs a [gitcvs] section added, and the parameter 'enabled' set to 1\n";
print "E \n";
print "error 1 GITCVS emulation disabled\n";
+ return 0;
}
if ( defined ( $cfg->{gitcvs}{logfile} ) )
} else {
$log->nofile();
}
+
+ return 1;
}
# Global_option option \n
$log->info("req_ci : " . ( defined($data) ? $data : "[NULL]" ));
+ if ( @ARGV && $ARGV[0] eq 'pserver')
+ {
+ print "error 1 pserver access cannot commit\n";
+ exit;
+ }
+
if ( -e $state->{CVSROOT} . "/index" )
{
print "error 1 Index already exists in git repo\n";
if (!otherbuf)
die("unable to read %s", sha1_to_hex(entry->delta->sha1));
delta_buf = diff_delta(otherbuf, othersize,
- buf, size, &delta_size, 0, NULL);
+ buf, size, &delta_size, 0);
if (!delta_buf || delta_size != entry->delta_size)
die("delta size changed");
free(buf);
struct unpacked {
struct object_entry *entry;
void *data;
- void **delta_index;
};
/*
if (sizediff >= max_size)
return -1;
delta_buf = diff_delta(old->data, oldsize,
- cur->data, size, &delta_size,
- max_size, old->delta_index);
+ cur->data, size, &delta_size, max_size);
if (!delta_buf)
return 0;
cur_entry->delta = old_entry;
*/
continue;
- free(n->delta_index);
free(n->data);
n->entry = entry;
n->data = read_sha1_file(entry->sha1, type, &size);
if (progress)
fputc('\n', stderr);
- for (i = 0; i < window; ++i) {
- free(array[i].delta_index);
+ for (i = 0; i < window; ++i)
free(array[i].data);
- }
free(array);
}
if (argv[1][1] == 'd')
out_buf = diff_delta(from_buf, from_size,
data_buf, data_size,
- &out_size, 0, NULL);
+ &out_size, 0);
else
out_buf = patch_delta(from_buf, from_size,
data_buf, data_size,