* Re: [PATCH 1/3] Introduce "rev-list --stop-at=<commit>".
From: Noel Grandin @ 2005-05-13 6:07 UTC (permalink / raw)
To: Petr Baudis; +Cc: Junio C Hamano, git
In-Reply-To: <20050513052901.GB16464@pasky.ji.cz>
[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]
Also, it should be called --stop-before given it's behaviour.
--stop-at implies that it includes the given commit.
Petr Baudis wrote:
>Dear diary, on Fri, May 13, 2005 at 02:15:15AM CEST, I got a letter
>where Junio C Hamano <junkio@cox.net> told me that...
>
>
>>Additional option, --stop-at=<commit>, is introduced. The
>>git-rev-list output stops just before showing the named commit.
>>
>>This is based on Thoms Gleixner's patch but slightly reworked.
>>
>>Signed-off-by: Junio C Hamano <junkio@cox.net>
>>
>>
>
>Won't apply for now - as I already said in the relevant thread, this
>makes no sense with the current git-rev-list output order, and even
>encourages using it in wrong way. It is ok when the merges are reported
>in a different way, but that's impossible without some repoid (I yet
>have to catch up with that thread :-).
>
>
>
NOTICE: Please note that this email, and the contents thereof,
are subject to the standard Peralex email disclaimer, which may
be found at: http://www.peralex.com/disclaimer.html
If you cannot access the disclaimer through the URL attached
and you wish to receive a copy thereof please send
an email to email@peralex.com
^ permalink raw reply
* [PATCH 0/4] Pulling refs files
From: Daniel Barkalow @ 2005-05-13 6:49 UTC (permalink / raw)
To: Petr Baudis; +Cc: git, Linus Torvalds
This series makes the following changes:
1: Adds support for having the C code know about the general existance of
.git/refs, and functions for writing these files.
2: Adds support in the generic pull code for fetching refs (and dummy
implementations).
3: Adds support in the HTTP pull code for fetching refs
4: Adds support in the rsh pull code for fetching refs; this requires
changes to the protocol. These changes should be sufficient to support
any future extension, however.
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply
* [PATCH 1/4] Support for refs directory
From: Daniel Barkalow @ 2005-05-13 6:53 UTC (permalink / raw)
To: Petr Baudis; +Cc: git, Linus Torvalds
In-Reply-To: <Pine.LNX.4.21.0505130245260.30848-100000@iabervon.org>
Add support for reading and writing files in the refs directory.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Index: Makefile
===================================================================
--- 2a5e43fa9318a648bfb4dbf64208f4c26905a5f8/Makefile (mode:100644 sha1:6afcb3e867a6857f9128dba877e433c12366c1f4)
+++ adc28203a55e7e9d3c0b4f6546ea0c2b99106f24/Makefile (mode:100644 sha1:653912b7290d1a28860db41f602fbf15ca2d9aa5)
@@ -36,9 +36,10 @@
$(INSTALL) $(PROG) $(SCRIPTS) $(dest)$(bin)
LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o \
- tag.o date.o
+ tag.o date.o refs.o
+
LIB_FILE=libgit.a
-LIB_H=cache.h object.h blob.h tree.h commit.h tag.h
+LIB_H=cache.h object.h blob.h tree.h commit.h tag.h refs.h
LIB_H += strbuf.h
LIB_OBJS += strbuf.o
Index: cache.h
===================================================================
--- 2a5e43fa9318a648bfb4dbf64208f4c26905a5f8/cache.h (mode:100644 sha1:c06b94107e0e1149be0ad642812e8d4a42f2193c)
+++ adc28203a55e7e9d3c0b4f6546ea0c2b99106f24/cache.h (mode:100644 sha1:ca9d13a972e05d8d0aa15babd5a963688fdd5968)
@@ -110,8 +110,10 @@
#define GIT_DIR_ENVIRONMENT "GIT_DIR"
#define DEFAULT_GIT_DIR_ENVIRONMENT ".git"
#define DB_ENVIRONMENT "GIT_OBJECT_DIRECTORY"
+#define REFS_ENVIRONMENT "GIT_REFS_DIRECTORY"
#define INDEX_ENVIRONMENT "GIT_INDEX_FILE"
+extern char *get_refs_directory(void);
extern char *get_object_directory(void);
extern char *get_index_file(void);
Index: init-db.c
===================================================================
--- 2a5e43fa9318a648bfb4dbf64208f4c26905a5f8/init-db.c (mode:100644 sha1:b6bb78356762bd28261949da54638f46776e6d4b)
+++ adc28203a55e7e9d3c0b4f6546ea0c2b99106f24/init-db.c (mode:100644 sha1:3441a35d7c2eb88e76db4886e8c068ca898ea8fd)
@@ -40,6 +40,7 @@
memcpy(path, sha1_dir, len);
safe_create_dir(sha1_dir);
+ safe_create_dir(get_refs_directory());
for (i = 0; i < 256; i++) {
sprintf(path+len, "/%02x", i);
safe_create_dir(path);
Index: refs.c
===================================================================
--- /dev/null (tree:2a5e43fa9318a648bfb4dbf64208f4c26905a5f8)
+++ adc28203a55e7e9d3c0b4f6546ea0c2b99106f24/refs.c (mode:100644 sha1:9ba5696c15d8597236e1f5b7a4dbd609045efc81)
@@ -0,0 +1,139 @@
+#include "refs.h"
+#include "cache.h"
+
+#include <errno.h>
+
+static char *split_ref_file_name(const char *dir, const char *name)
+{
+ char *base = get_refs_directory();
+ int baselen = strlen(base);
+ int dirlen = strlen(dir);
+ int namelen = strlen(name);
+ char *ret;
+ if (dir[0] == '.')
+ return NULL;
+ if (strchr(dir, '/'))
+ return NULL;
+ if (strchr(name, '/'))
+ return NULL;
+ ret = xmalloc(baselen + 3 + dirlen + namelen);
+ strcpy(ret, base);
+ ret[baselen] = '/';
+ strcpy(ret + baselen + 1, dir);
+ ret[baselen + 1 + dirlen] = '/';
+ strcpy(ret + baselen + 2 + dirlen, name);
+ ret[baselen + 2 + dirlen + namelen] = '\0';
+ return ret;
+}
+
+static char *ref_file_name(const char *ref)
+{
+ char *base = get_refs_directory();
+ int baselen = strlen(base);
+ int reflen = strlen(ref);
+ char *ret;
+ char *check;
+ if (ref[0] == '.')
+ return NULL;
+ check = strchr(ref, '/');
+ if (!check)
+ return NULL;
+ if (strchr(check + 1, '/'))
+ return NULL;
+ ret = xmalloc(baselen + 2 + reflen);
+ strcpy(ret, base);
+ ret[baselen] = '/';
+ strcpy(ret + baselen + 1, ref);
+ ret[baselen + 1 + reflen] = '\0';
+ return ret;
+}
+
+static int read_ref_file(char *filename, unsigned char *sha1) {
+ int fd = open(filename, O_RDONLY);
+ char hex[41];
+ if (fd < 0) {
+ return error("Couldn't open %s\n", filename);
+ }
+ if ((read(fd, hex, 41) < 41) ||
+ (hex[40] != '\n') ||
+ get_sha1_hex(hex, sha1)) {
+ error("Couldn't read a hash from %s\n", filename);
+ close(fd);
+ return -1;
+ }
+ close(fd);
+ return 0;
+}
+
+int get_split_ref_sha1(const char *dir, const char *name, unsigned char *sha1)
+{
+ char *filename = split_ref_file_name(dir, name);
+ int retval;
+ if (!filename)
+ return -1;
+ retval = read_ref_file(filename, sha1);
+ free(filename);
+ return retval;
+}
+
+int get_ref_sha1(const char *ref, unsigned char *sha1)
+{
+ char *filename = ref_file_name(ref);
+ int retval;
+ if (!filename)
+ return -1;
+ retval = read_ref_file(filename, sha1);
+ free(filename);
+ return retval;
+}
+
+int write_split_ref_sha1(const char *dir, const char *name,
+ unsigned char *sha1)
+{
+ char *filename = split_ref_file_name(dir, name);
+ char *hex = sha1_to_hex(sha1);
+ char term = '\n';
+ int fd;
+ if (!filename)
+ return -1;
+ unlink(filename);
+ fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0666);
+ if (fd < 0 && errno == ENOENT) {
+ char *dirname = split_ref_file_name(dir, "");
+ mkdir(dirname, 0755);
+ free(dirname);
+ fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0666);
+ }
+ if (fd < 0) {
+ error("Couldn't open for writing %s: %s\n", filename,
+ strerror(errno));
+ free(filename);
+ return -1;
+ }
+ if (write(fd, hex, 40) < 40 ||
+ write(fd, &term, 1) < 1) {
+ error("Couldn't write %s\n", filename);
+ free(filename);
+ close(fd);
+ return -1;
+ }
+ close(fd);
+ return 0;
+
+}
+
+int split_ref(char **dir, char **name, const char *ref)
+{
+ char *middle = strchr(ref, '/');
+ if (ref[0] == '.')
+ return -1;
+ if (!middle)
+ return -1;
+ if (strchr(middle + 1, '/'))
+ return -1;
+ *dir = xmalloc(middle - ref + 1);
+ *name = strdup(middle + 1);
+ (*dir)[middle - ref] = '\0';
+ memcpy(*dir, ref, middle - ref);
+ return 0;
+}
Index: refs.h
===================================================================
--- /dev/null (tree:2a5e43fa9318a648bfb4dbf64208f4c26905a5f8)
+++ adc28203a55e7e9d3c0b4f6546ea0c2b99106f24/refs.h (mode:100644 sha1:9ef6ed7563f70273aef6574a01d5626fee28345a)
@@ -0,0 +1,20 @@
+#ifndef REFS_H
+#define REFS_H
+
+/** Reads the refs file specified into sha1 **/
+extern int get_split_ref_sha1(const char *dir, const char *name,
+ unsigned char *sha1);
+
+/** Reads the refs file specified into sha1 **/
+extern int get_ref_sha1(const char *ref, unsigned char *sha1);
+
+/** Writes sha1 into the refs file specified **/
+extern int write_split_ref_sha1(const char *dir, const char *name,
+ unsigned char *sha1);
+
+/** Sets dir and name to the directory and name parts of ref, in new
+ * storage.
+ **/
+extern int split_ref(char **dir, char **name, const char *ref);
+
+#endif /* REFS_H */
Index: sha1_file.c
===================================================================
--- 2a5e43fa9318a648bfb4dbf64208f4c26905a5f8/sha1_file.c (mode:100644 sha1:942b673dc3c7fa9f057c5c452e3a1b73eaeb8707)
+++ adc28203a55e7e9d3c0b4f6546ea0c2b99106f24/sha1_file.c (mode:100644 sha1:a3ab45fbb39f37622ae191fe5c3cbaf30389ec74)
@@ -59,7 +59,7 @@
return get_sha1_hex(buffer, result);
}
-static char *git_dir, *git_object_dir, *git_index_file;
+static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir;
static void setup_git_env(void)
{
git_dir = gitenv(GIT_DIR_ENVIRONMENT);
@@ -70,6 +70,11 @@
git_object_dir = xmalloc(strlen(git_dir) + 9);
sprintf(git_object_dir, "%s/objects", git_dir);
}
+ git_refs_dir = gitenv(REFS_ENVIRONMENT);
+ if (!git_refs_dir) {
+ git_refs_dir = xmalloc(strlen(git_dir) + 6);
+ sprintf(git_refs_dir, "%s/refs", git_dir);
+ }
git_index_file = gitenv(INDEX_ENVIRONMENT);
if (!git_index_file) {
git_index_file = xmalloc(strlen(git_dir) + 7);
@@ -91,6 +96,13 @@
return git_index_file;
}
+char *get_refs_directory(void)
+{
+ if (!git_refs_dir)
+ setup_git_env();
+ return git_refs_dir;
+}
+
int get_sha1(const char *str, unsigned char *sha1)
{
static char pathname[PATH_MAX];
^ permalink raw reply
* [PATCH 2/4] Generic support for pulling refs
From: Daniel Barkalow @ 2005-05-13 6:56 UTC (permalink / raw)
To: Petr Baudis; +Cc: git, Linus Torvalds
In-Reply-To: <Pine.LNX.4.21.0505130245260.30848-100000@iabervon.org>
This adds a pull method to pull refs, provides dummy implementations for
the existing programs, and uses that method to try to get refs if
requested. It also adds generic support for writing the target to a refs
file.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Index: http-pull.c
===================================================================
--- adc28203a55e7e9d3c0b4f6546ea0c2b99106f24/http-pull.c (mode:100644 sha1:024457a9895ab10c4ef18aa6e232d12fdaab4da9)
+++ 90e05f81df7b7fd2c39d252b6f9a2374d4dd0cf5/http-pull.c (mode:100644 sha1:af4e82fdf9c58a15564d40bef85d57e9f6626727)
@@ -98,6 +98,11 @@
return 0;
}
+int fetch_ref(char *dir, char *name, unsigned char *sha1)
+{
+ return -1;
+}
+
int main(int argc, char **argv)
{
char *commit_id;
Index: local-pull.c
===================================================================
--- adc28203a55e7e9d3c0b4f6546ea0c2b99106f24/local-pull.c (mode:100644 sha1:3a342ab18390d7ce0df1f970a4961b31548a9417)
+++ 90e05f81df7b7fd2c39d252b6f9a2374d4dd0cf5/local-pull.c (mode:100644 sha1:73aad965d0b190627aa95726e4feaa2623d31d26)
@@ -18,6 +18,11 @@
static char *path;
+int fetch_ref(char *dir, char *name, unsigned char *sha1)
+{
+ return -1;
+}
+
int fetch(unsigned char *sha1)
{
static int object_name_start = -1;
Index: pull.c
===================================================================
--- adc28203a55e7e9d3c0b4f6546ea0c2b99106f24/pull.c (mode:100644 sha1:0bed44f4cbf6716cfc3152f35626123992766408)
+++ 90e05f81df7b7fd2c39d252b6f9a2374d4dd0cf5/pull.c (mode:100644 sha1:d4d858cd638e915096a408ba3c37090a1b460c21)
@@ -3,6 +3,12 @@
#include "cache.h"
#include "commit.h"
#include "tree.h"
+#include "tag.h"
+
+#include "refs.h"
+
+char *write_ref_dir = NULL;
+char *write_ref_name = NULL;
int get_tree = 0;
int get_history = 0;
@@ -98,16 +104,52 @@
return 0;
}
+static int process_tag(unsigned char *sha1)
+{
+ return 0;
+}
+
+static int process_unknown(unsigned char *sha1)
+{
+ struct object *obj;
+ if (make_sure_we_have_it(NULL, sha1))
+ return -1;
+ obj = parse_object(sha1);
+ if (obj->type == commit_type) {
+ memcpy(current_commit_sha1, sha1, 20);
+ return process_commit(sha1);
+ } else if (obj->type == tag_type)
+ return process_tag(sha1);
+ return error("Cannot pull a %s object", obj->type);
+}
+
+static int interpret_target(char *target, unsigned char *sha1)
+{
+ char *dir, *name;
+ if (!get_sha1_hex(target, sha1))
+ return 0;
+ if (!split_ref(&dir, &name, target)) {
+ if (!fetch_ref(dir, name, sha1)) {
+ return 0;
+ }
+ }
+ return -1;
+}
+
int pull(char *target)
{
int retval;
unsigned char sha1[20];
- retval = get_sha1_hex(target, sha1);
- if (retval)
- return retval;
- retval = make_sure_we_have_it(commitS, sha1);
+ retval = interpret_target(target, sha1);
+ if (retval) {
+ return error("Could not interpret %s as something to pull",
+ target);
+ }
+ retval = process_unknown(sha1);
if (retval)
return retval;
- memcpy(current_commit_sha1, sha1, 20);
- return process_commit(sha1);
+
+ if (write_ref_dir && write_ref_name)
+ write_split_ref_sha1(write_ref_dir, write_ref_name, sha1);
+ return 0;
}
Index: pull.h
===================================================================
--- adc28203a55e7e9d3c0b4f6546ea0c2b99106f24/pull.h (mode:100644 sha1:d2dca02de7c23426e84e9f63762df9428933e8d8)
+++ 90e05f81df7b7fd2c39d252b6f9a2374d4dd0cf5/pull.h (mode:100644 sha1:de0e9245b68856bcf84c033650b6b3eb151641e2)
@@ -4,6 +4,12 @@
/** To be provided by the particular implementation. **/
extern int fetch(unsigned char *sha1);
+extern int fetch_ref(char *dir, char *name, unsigned char *sha1);
+
+/** Ref filename to write target to. **/
+extern char *write_ref_dir;
+extern char *write_ref_name;
+
/** Set to fetch the target tree. */
extern int get_tree;
Index: rpull.c
===================================================================
--- adc28203a55e7e9d3c0b4f6546ea0c2b99106f24/rpull.c (mode:100644 sha1:b48e63157c66c160b9751603a92831f77106044c)
+++ 90e05f81df7b7fd2c39d252b6f9a2374d4dd0cf5/rpull.c (mode:100644 sha1:493fcdae670ebb1d93b8c75d3e28798e060d7537)
@@ -22,6 +22,11 @@
return ret;
}
+int fetch_ref(char *dir, char *name, unsigned char *sha1)
+{
+ return -1;
+}
+
int main(int argc, char **argv)
{
char *commit_id;
^ permalink raw reply
* [PATCH 3/4] Pull refs by HTTP
From: Daniel Barkalow @ 2005-05-13 6:57 UTC (permalink / raw)
To: Petr Baudis; +Cc: git, Linus Torvalds
In-Reply-To: <Pine.LNX.4.21.0505130245260.30848-100000@iabervon.org>
Adds support for pulling refs by HTTP, and an option for writing the
pulled ref to a file.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Index: http-pull.c
===================================================================
--- 90e05f81df7b7fd2c39d252b6f9a2374d4dd0cf5/http-pull.c (mode:100644 sha1:af4e82fdf9c58a15564d40bef85d57e9f6626727)
+++ 4931f2d8b9c2ab83718f6446d5ef3af5fa320b3f/http-pull.c (mode:100644 sha1:6e8dc48ddd0ea1ae89074f6ae0d89c54303895b7)
@@ -7,6 +7,8 @@
#include <errno.h>
#include <stdio.h>
+#include "refs.h"
+
#include "pull.h"
#include <curl/curl.h>
@@ -45,6 +47,23 @@
return size;
}
+struct buffer
+{
+ size_t posn;
+ size_t size;
+ void *buffer;
+};
+
+static size_t fwrite_buffer(void *ptr, size_t eltsize, size_t nmemb,
+ struct buffer *buffer) {
+ size_t size = eltsize * nmemb;
+ if (size > buffer->size - buffer->posn)
+ size = buffer->size - buffer->posn;
+ memcpy(buffer->buffer + buffer->posn, ptr, size);
+ buffer->posn += size;
+ return size;
+}
+
int fetch(unsigned char *sha1)
{
char *hex = sha1_to_hex(sha1);
@@ -93,14 +112,42 @@
unlink(filename);
return error("File %s has bad hash\n", hex);
}
-
pull_say("got %s\n", hex);
return 0;
}
int fetch_ref(char *dir, char *name, unsigned char *sha1)
{
- return -1;
+ char *url, *posn;
+ char hex[42];
+ struct buffer buffer;
+ buffer.size = 41;
+ buffer.posn = 0;
+ buffer.buffer = hex;
+ hex[41] = '\0';
+
+ curl_easy_setopt(curl, CURLOPT_FILE, &buffer);
+ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
+
+ url = xmalloc(strlen(base) + 7 + strlen(dir) + strlen(name));
+ strcpy(url, base);
+ posn = url + strlen(base);
+ strcpy(posn, "refs/");
+ posn += 5;
+ strcpy(posn, dir);
+ posn += strlen(dir);
+ *(posn++) = '/';
+ strcpy(posn, name);
+
+ curl_easy_setopt(curl, CURLOPT_URL, url);
+
+ if (curl_easy_perform(curl))
+ return error("Couldn't get %s for %s/%s\n", url,
+ dir, name);
+
+ hex[40] = '\0';
+ get_sha1_hex(hex, sha1);
+ return 0;
}
int main(int argc, char **argv)
@@ -120,6 +167,10 @@
get_history = 1;
} else if (argv[arg][1] == 'v') {
get_verbosely = 1;
+ } else if (argv[arg][1] == 'w') {
+ char *write_ref = argv[arg + 1];
+ split_ref(&write_ref_dir, &write_ref_name, write_ref);
+ arg++;
}
arg++;
}
^ permalink raw reply
* [PATCH 4/4] Pulling refs by ssh
From: Daniel Barkalow @ 2005-05-13 7:01 UTC (permalink / raw)
To: Petr Baudis; +Cc: git, Linus Torvalds
In-Reply-To: <Pine.LNX.4.21.0505130245260.30848-100000@iabervon.org>
Adds support for pulling refs by rsh.
This changes the rsh protocol to allow requests for different things, and
to allow the server to report that it doesn't have something without
breaking the connection.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Index: rpull.c
===================================================================
--- 4931f2d8b9c2ab83718f6446d5ef3af5fa320b3f/rpull.c (mode:100644 sha1:493fcdae670ebb1d93b8c75d3e28798e060d7537)
+++ a219d8e31f3882aaa32e7dbac7a1f92b35a9dbff/rpull.c (mode:100644 sha1:cce9e71becc95f728d320ef49e11a647a420b75d)
@@ -8,6 +8,7 @@
#include <stdio.h>
#include "rsh.h"
#include "pull.h"
+#include "refs.h"
static int fd_in;
static int fd_out;
@@ -15,16 +16,34 @@
int fetch(unsigned char *sha1)
{
int ret;
+ signed char remote;
+ char type = 'o';
+ if (has_sha1_file(sha1))
+ return 0;
+ write(fd_out, &type, 1);
write(fd_out, sha1, 20);
+ if (read(fd_in, &remote, 1) < 1)
+ return -1;
+ if (remote < 0)
+ return remote;
ret = write_sha1_from_fd(sha1, fd_in);
if (!ret)
pull_say("got %s\n", sha1_to_hex(sha1));
return ret;
}
-int fetch_ref(char *dir, char *name, unsigned char *sha1)
+int fetch_ref(char *name, char *dir, unsigned char *sha1)
{
- return -1;
+ signed char remote;
+ char type = 'r';
+ write(fd_out, &type, 1);
+ write(fd_out, name, strlen(name) + 1);
+ write(fd_out, dir, strlen(dir) + 1);
+ read(fd_in, &remote, 1);
+ if (remote < 0)
+ return remote;
+ read(fd_in, sha1, 20);
+ return 0;
}
int main(int argc, char **argv)
@@ -44,6 +63,10 @@
get_history = 1;
} else if (argv[arg][1] == 'v') {
get_verbosely = 1;
+ } else if (argv[arg][1] == 'w') {
+ char *write_ref = argv[arg + 1];
+ split_ref(&write_ref_dir, &write_ref_name, write_ref);
+ arg++;
}
arg++;
}
Index: rpush.c
===================================================================
--- 4931f2d8b9c2ab83718f6446d5ef3af5fa320b3f/rpush.c (mode:100644 sha1:26518846704ecf63ad00390599b251aa1b32713e)
+++ a219d8e31f3882aaa32e7dbac7a1f92b35a9dbff/rpush.c (mode:100644 sha1:c3cad4eac186307e743eacb913a0b382a455d1f4)
@@ -2,47 +2,98 @@
#include "rsh.h"
#include <sys/socket.h>
#include <errno.h>
+#include "refs.h"
-void service(int fd_in, int fd_out) {
+int serve_object(int fd_in, int fd_out) {
ssize_t size;
- int posn;
+ int posn = 0;
char sha1[20];
unsigned long objsize;
void *buf;
+ signed char remote;
do {
- posn = 0;
- do {
- size = read(fd_in, sha1 + posn, 20 - posn);
- if (size < 0) {
- perror("rpush: read ");
- return;
+ size = read(fd_in, sha1 + posn, 20 - posn);
+ if (size < 0) {
+ perror("rpush: read ");
+ return -1;
+ }
+ if (!size)
+ return -1;
+ posn += size;
+ } while (posn < 20);
+
+ /* fprintf(stderr, "Serving %s\n", sha1_to_hex(sha1)); */
+ remote = 0;
+
+ buf = map_sha1_file(sha1, &objsize);
+
+ if (!buf) {
+ fprintf(stderr, "rpush: could not find %s\n",
+ sha1_to_hex(sha1));
+ remote = -1;
+ }
+
+ write(fd_out, &remote, 1);
+
+ if (remote < 0)
+ return 0;
+
+ posn = 0;
+ do {
+ size = write(fd_out, buf + posn, objsize - posn);
+ if (size <= 0) {
+ if (!size) {
+ fprintf(stderr, "rpush: write closed");
+ } else {
+ perror("rpush: write ");
}
- if (!size)
- return;
- posn += size;
- } while (posn < 20);
+ return -1;
+ }
+ posn += size;
+ } while (posn < objsize);
+ return 0;
+}
- /* fprintf(stderr, "Serving %s\n", sha1_to_hex(sha1)); */
+int serve_ref(int fd_in, int fd_out)
+{
+ char dir[PATH_MAX], name[PATH_MAX];
+ unsigned char sha1[20];
+ int posn = 0;
+ signed char remote = 0;
+ do {
+ if (read(fd_in, dir + posn, 1) < 1)
+ return -1;
+ posn++;
+ } while (dir[posn - 1]);
+ posn = 0;
+ do {
+ if (read(fd_in, name + posn, 1) < 1)
+ return -1;
+ posn++;
+ } while (name[posn - 1]);
+ if (get_split_ref_sha1(dir, name, sha1))
+ remote = -1;
+ write(fd_out, &remote, 1);
+ if (remote)
+ return 0;
+ write(fd_out, sha1, 20);
+ return 0;
+}
- buf = map_sha1_file(sha1, &objsize);
- if (!buf) {
- fprintf(stderr, "rpush: could not find %s\n",
- sha1_to_hex(sha1));
+void service(int fd_in, int fd_out) {
+ char type;
+ int retval;
+ do {
+ retval = read(fd_in, &type, 1);
+ if (retval < 1) {
+ if (retval < 0)
+ perror("rpush: read ");
return;
}
- posn = 0;
- do {
- size = write(fd_out, buf + posn, objsize - posn);
- if (size <= 0) {
- if (!size) {
- fprintf(stderr, "rpush: write closed");
- } else {
- perror("rpush: write ");
- }
- return;
- }
- posn += size;
- } while (posn < objsize);
+ if (type == 'o' && serve_object(fd_in, fd_out))
+ return;
+ if (type == 'r' && serve_ref(fd_in, fd_out))
+ return;
} while (1);
}
@@ -53,6 +104,8 @@
char *url;
int fd_in, fd_out;
while (arg < argc && argv[arg][0] == '-') {
+ if (argv[arg][1] == 'w')
+ arg++;
arg++;
}
if (argc < arg + 2) {
Index: rsh.c
===================================================================
--- 4931f2d8b9c2ab83718f6446d5ef3af5fa320b3f/rsh.c (mode:100644 sha1:5d1cb9d578a8e679fc190a9d7d2c842ad811223f)
+++ a219d8e31f3882aaa32e7dbac7a1f92b35a9dbff/rsh.c (mode:100644 sha1:192d8f67e9a5e2bf7bb9e14c8c037dff49e74d57)
@@ -36,8 +36,8 @@
*(path++) = '\0';
/* ssh <host> 'cd /<path>; stdio-pull <arg...> <commit-id>' */
snprintf(command, COMMAND_SIZE,
- "cd /%s; %s=objects %s",
- path, DB_ENVIRONMENT, remote_prog);
+ "cd /%s; GIT_DIR=. %s",
+ path, remote_prog);
posn = command + strlen(command);
for (i = 0; i < rmt_argc; i++) {
*(posn++) = ' ';
^ permalink raw reply
* Re: [PATCH 1/3] Introduce "rev-list --stop-at=<commit>".
From: Junio C Hamano @ 2005-05-13 7:36 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
In-Reply-To: <20050513052901.GB16464@pasky.ji.cz>
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
PB> Won't apply for now -
Consider it retracted. It does not make sense to me either.
^ permalink raw reply
* Re: [PATCH] [RFD] Add repoid identifier to commit [its a workspace id, isn't it?]
From: Thomas Gleixner @ 2005-05-13 8:36 UTC (permalink / raw)
To: jon; +Cc: H. Peter Anvin, git
In-Reply-To: <2cfc4032050512183788e01fc@mail.gmail.com>
On Fri, 2005-05-13 at 11:37 +1000, Jon Seymour wrote:
> I think I understand what Thomas is trying to achieve, but I think
> there is a naming problem here. The marker really isn't a repoid - it
> is a workspace id.
I did not think about the naming convention here. I was just looking at
the repositories of Dave Miller - net-2.6 and sparc-2.6 - which are not
seperable by any automated mechanism due to the fact that Dave uses the
same committer name for both, which is reasonable.
You are right, those are workspaces which happen to have a seperate
public repository.
> From the point of view of a given change epoch, M always wants to see
> "local changes occur first". To know what changes were local to M you
> need to mark the changes that workspace M made with an identifier
> saying that M did this in this workspace, hence the need for the
> marker that Thomas is proposing.
My main concern here is to be able to see a change in the context in
which it was made.
In distributed development a change made in workspace A is correct in
the context of A and a change made in the workspace B is correct in the
context of B. By merging these maybe unrelated changes produce a
problem. Add a random number of changes to increase the complexitiy.
It is helpful from my experience to have a possibility to see the
seperate changes in the context where they were made to understand why
the change was made.
If your history is cluttered by the head forward cloning you have more
work to deduce the information you want to have instead of having it
available on demand by a tool.
> Assuming that there is value in being able to reconstruct the merge
> order from the perspective of workspaces that have contributed to the
> global history it would seem that Thomas's suggestion of marking each
> commit with an identifier is reasonable, however, I think the name of
> the identifier should change - what's being tracked is a workspace,
> not a repository.
Ack.
The question is how to automate those workspace identifiers in a
senseful way. A shared object repository makes it necessary to keep the
identifier in workspace itself. A first idea might be
a .git_workspace_id file in the toplevel directory of the workspace,
which can automatically be ignored by all git tools. Maybe a ignore rule
for all .git* files is also reasonable to make future extensions simpler
tglx
^ permalink raw reply
* Re: [PATCH] Ignore file filter
From: David Greaves @ 2005-05-13 8:50 UTC (permalink / raw)
To: Junio C Hamano; +Cc: GIT Mailing Lists
In-Reply-To: <7v64xodshs.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
>Just a half theoretical question. How well does this perform
>when your filenames have:
>
> - ' ' (ASCII 0x20)
> - '\t' (ASCII 0x09)
> - '\n' (ASCII 0x0a)
> - '`' (ASCII 0x60) backtick
> - '$' (ASCII 0x24) dollar sign
>
>in them? Or is it the case that the rest of the Cogito is not
>careful enough and it does not matter to be careful only in this
>script?
>
>
That's what the:
zerosep=$'-d "\0"'
is for.
It looks like the shell 'read' doesn't honour it though - I couldn't
make it work.
However, thanks, after I fixed the quotes I missed in:
-o \( $pass_files -eq 1 -a -f "$file" \) \
-o \( $pass_dirs -eq 1 -a -d "$file" \) \
-o \( $pass_links -eq 1 -a -h "$file" \) \
it handles all cases above except \n (of course)
Frankly I think we're beyond shell programming and we should be using
perl (IMHO as the 'best' and most portable text handler)
It also has a *fantastic* test harness available.
David
^ permalink raw reply
* Re: [PATCH Cogito] Improve option parsing for cg-log
From: Marcel Holtmann @ 2005-05-13 9:05 UTC (permalink / raw)
To: Petr Baudis; +Cc: GIT Mailing List
In-Reply-To: <20050513054140.GF16464@pasky.ji.cz>
Hi Petr,
> > > > the attached patch changes the option parsing, because otherwise we are
> > > > stuck to a specific order.
> > >
> > > thanks, applied. However, you didn't include the -r options parsing in
> > > there yet.
> >
> > what do you mean by that?
>
> The -r option still must be after all the other options.
I see what you mean and it seems that I missed that option. Must be
because you put the list_commit_files() between them and I assumed that
there is no further option parsing.
Do you really wanna keep the double meaning of -r. Depending on a
previous -r it is $log_start or $log_end.
Regards
Marcel
^ permalink raw reply
* Re: Adapting scripts to work in current (not top) directory
From: Alexey Nezhdanov @ 2005-05-13 10:59 UTC (permalink / raw)
To: git
In-Reply-To: <20050512201215.GI324@pasky.ji.cz>
On Friday, 13 May 2005 00:12 Petr Baudis wrote:
> Dear diary, on Thu, May 12, 2005 at 03:58:10PM CEST, I got a letter
> where Alexey Nezhdanov <snake@penza-gsm.ru> told me that...
>
> > All git and cogito scripts wants .git subdirectory. If I'm in a
> > subdirectory that have no .git direcory in it I'm out of luck.
>
> This is fine for Cogito, but Git itself shouldn't care - unless you mean
> the bundled mini-plumbing scripts. I don't know if anyone (and who) uses
> them except Linus, but I'm not likely to make much effort to maintain
> them, or even to actually accept any non-trivial changes to them.
>
> > I have wrote an example script that determines the lowest possible .git
> > directory position and changes to it to satisfy user request.
> >
> > Problems with script:
> > 1) May be I misunderstood the git ideology and it needs not this at all.
>
> Cogito really needs it.
Ok, so sticking with cogito.
> > if point (1) is false then there are couple of other problems:
> > 2) Script is extremelly ugly. I'm a week bash programmer so please
> > criticize.
> > 3) This logic shold be somehow embedded to all git- and cg-
> > scripts. I can not figure how to do it non-intruisively.
>
> Add it to cg-Xlib. You can just update $_git appropriately. (Except when
> you were explicitly passed GIT_DIR.)
ok, that's easy.
>
> > gitpath=
> > subpath=
> > curpath=`pwd`
> > for ((i=2;i<9999;i=i+1)) ; do {
> > path1=`echo $curpath | cut -d / -f 0-$i`
> > path2=`echo $curpath | cut -d / -f $((i+1))-`
> > [ -d "$path1"/.git ] && gitpath=$path1 && subpath=$path2
> > [ "$path1" == "$curpath" ] && break
> > }; done
>
> I would gradually trim the $curpath by $(dirname) until I hit
> $curpath/.git or the root directory.
I have opted for current directory and not root. Explanation is later this
mail. New variant:
=========================
--- /home/snake/scm/cogito/cg-Xlib 2005-05-12 08:47:29.000000000 +0400
+++ cg-Xlib 2005-05-13 13:40:58.000000000 +0400
@@ -8,7 +8,17 @@
_cg_cmd=${0##*/}
-_git=${GIT_DIR:-.git}
+repopath=`pwd`
+while ((1)) ; do {
+ [ -d "$repopath/.git" ] && break
+ [ "$repopath" == "/" ] && {
+ repopath=`pwd`;
+ break;
+ };
+ repopath=`dirname $repopath`
+}; done
+
+_git=${GIT_DIR:-$repopath/.git}
_git_objects=${GIT_OBJECT_DIRECTORY:-$_git/objects}
=========================
Here is a problem:
Because of git backend only some of the commands should be enabled to work
from current directory. F.e. cg-init should not scan upper directories for
".git" but should instead stick to current directory. In the script above
this workarounded as choosing current directory instead of root but this will
broke if we trying to initialise repo in a subdirectory of another repo.
So I have analysed list of cogito commands to find out which ones should be
adopted to use "find repo" behaivoir:
"+" means "definitely yes"
"-" means "definitely no"
"?" means "not sure"
"." means "not matter"
+ cg-add
? cg-admin-lsobj
- cg-admin-uncommit
? cg-branch-add
? cg-branch-ls
- cg-cancel
- cg-clone
- cg-commit
+ cg-diff
- cg-export
. cg-help
- cg-init
+ cg-log
+ cg-ls
- cg-merge
+ cg-mkpatch
? cg-patch
- cg-pull
- cg-restore
+ cg-rm
- cg-seek
+ cg-status
- cg-tag
? cg-tag-ls
- cg-update
. cg-version
Any opinions?
--
Respectfully
Alexey Nezhdanov
^ permalink raw reply
* Re: [PATCH 3/4] Pull refs by HTTP
From: Edgar Toernig @ 2005-05-13 11:15 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: Petr Baudis, git, Linus Torvalds
In-Reply-To: <Pine.LNX.4.21.0505130256150.30848-100000@iabervon.org>
Daniel Barkalow wrote:
>
> + url = xmalloc(strlen(base) + 7 + strlen(dir) + strlen(name));
> + strcpy(url, base);
> + posn = url + strlen(base);
> + strcpy(posn, "refs/");
> + posn += 5;
> + strcpy(posn, dir);
> + posn += strlen(dir);
> + *(posn++) = '/';
> + strcpy(posn, name);
Have you ever heard of sprintf & co?
sprintf(url, "%srefs/%s/%s", base, dir, name);
Ciao, ET.
^ permalink raw reply
* [PATCH Cogito] Fix file list wrapping of cg-log
From: Marcel Holtmann @ 2005-05-13 11:25 UTC (permalink / raw)
To: Petr Baudis; +Cc: GIT Mailing List
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
Hi Petr,
the attached patch fixes the file list wrapping for the second and
following lines by adding two extra spaces. It also corrects the line
width counting that is wrong after the first line break.
Regards
Marcel
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 575 bytes --]
Index: cg-log
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-log (mode:100755)
+++ uncommitted/cg-log (mode:100755)
@@ -69,6 +69,7 @@
{
tree1="$1"
tree2="$2"
+ line=
sep=" * $colfiles"
# List all files for for the initial commit
if [ -z $tree2 ]; then
@@ -84,9 +85,9 @@
line="$line$sep$file"
echo -n "$file"
else
- line="$file"
+ line=" $file"
echo "$coldefault"
- echo -n " $colfiles$file"
+ echo -n " $colfiles$file"
fi
done
echo "$coldefault:"
^ permalink raw reply
* Re: [PATCH Cogito] Improve option parsing for cg-log
From: Dan Holmsand @ 2005-05-13 11:32 UTC (permalink / raw)
To: git
In-Reply-To: <20050513054140.GF16464@pasky.ji.cz>
[-- Attachment #1: Type: text/plain, Size: 442 bytes --]
Petr Baudis wrote:
> The -r option still must be after all the other options.
>
I've been thinking about option parsing as well, and I think cogito
could use a more "getopt-like" handling of options. "cg-log -cf"
or "cg-diff -rorigin" is just so much easier to type...
The attached patch implements that for cg-log and cg-diff, by means of
two new helper functions in cg-Xlib. It also improves error-handling a bit.
How about it?
/dan
[-- Attachment #2: optparse.patch --]
[-- Type: text/x-patch, Size: 5284 bytes --]
Better option parsing in cg-diff and cg-log. Uses a new function, optparse,
in cg-Xlib, that allows for getopt-style option parsing.
This means that "cg-log -cf" is equivalent to "cg-log -c -f", as is
"cg-log -fc" and "cg-log -fc -rHEAD --" and even
"cg-log --file-list --color --revision=HEAD".
---
cg-Xlib | 33 ++++++++++++++++++++++++++++++
cg-diff | 53 ++++++++++++++++++++++---------------------------
cg-log | 69 ++++++++++++++++++++++++----------------------------------------
3 files changed, 83 insertions(+), 72 deletions(-)
Index: cg-Xlib
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-Xlib (mode:100755)
+++ 048128149b56f55427713c78a8a3ca9da811e589/cg-Xlib (mode:100755)
@@ -62,6 +62,39 @@
fi
done
+# option parsing
+
+opts=($@)
+
+optshift() {
+ unset opts[0]
+ opts=("${opts[@]}")
+ [ -z "$1" -o -n "$opts" ] || die "option \`$1' requires an argument"
+}
+
+optparse() {
+ [ -z "$1" ] && case $opts in
+ --) optshift; return 1 ;;
+ -*) return 0 ;;
+ *) return 1 ;;
+ esac
+
+ local match=${1%=} minmatch=${2:-1} o=$opts val
+ [[ $1 == *= ]] && val=$match
+ case $match in
+ --*) [ "$val" ] && o=${opts%%=*}
+ [ ${#o} -ge $((2 + $minmatch)) -a \
+ "${match:0:${#o}}" = "$o" ] || return 1
+ [[ -n "$val" && "$opts" == *=* ]] && opts[0]=${opts#*=} \
+ || optshift $val ;;
+ -?) [[ $o == $match* ]] || return 1
+ [[ $o != -?-* || -n "$val" ]] || die "unrecognized option \`$o'"
+ opts[0]=${o#$match}
+ [ "$opts" ] && { [ "$val" ] || opts[0]=-${opts}; } \
+ || optshift $val ;;
+ *) die "optparse cannot handle $1" ;;
+ esac
+}
# Compatibility hacks:
# 2005-04-26
Index: cg-diff
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-diff (mode:100755)
+++ 048128149b56f55427713c78a8a3ca9da811e589/cg-diff (mode:100755)
@@ -19,34 +19,33 @@
. ${COGITO_LIB}cg-Xlib
-id1=" "
-id2=" "
-parent=
+unset id1 id2 parent
+while optparse; do
+ if optparse -p || optparse --parent; then
+ parent=1
+ elif optparse -r= || optparse --revision=; then
+ if [ set != "${id1+set}" ]; then
+ id1=$opts
+ if [[ "$id1" == *:* ]]; then
+ id2=${id1#*:}
+ id1=${id1%:*}
+ fi
+ else
+ [ set != "${id2+set}" ] || die "too many versions"
+ id2=$opts
+ fi
+ optshift
+ else
+ die "unrecognized option \`$opts'"
+ fi
+done
+shift $(( $# - ${#opts[*]} ))
-# FIXME: The commandline parsing is awful.
-
-if [ "$1" = "-p" ]; then
- shift
- parent=1
-fi
-
-if [ "$1" = "-r" ]; then
- shift
- id1=$(echo "$1": | cut -d : -f 1)
- [ "$id1" != "$1" ] && id2=$(echo "$1": | cut -d : -f 2)
- shift
-fi
-
-if [ "$1" = "-r" ]; then
- shift
- id2="$1"
- shift
-fi
if [ "$parent" ]; then
id2="$id1"
- id1=$(parent-id "$id2" | head -n 1)
+ id1=$(parent-id "$id2" | head -n 1) || exit 1
fi
@@ -58,12 +57,8 @@
done
fi
-if [ "$id2" = " " ]; then
- if [ "$id1" != " " ]; then
- tree=$(tree-id "$id1")
- else
- tree=$(tree-id)
- fi
+if [ set != "${id2+set}" ]; then
+ tree=$(tree-id "${id1:-HEAD}") || exit 1
# Ensure to only diff modified files
git-update-cache --refresh
Index: cg-log
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-log (mode:100755)
+++ 048128149b56f55427713c78a8a3ca9da811e589/cg-log (mode:100755)
@@ -30,18 +30,11 @@
# at least somewhere it does. Bash is broken.
trap exit SIGPIPE
-colheader=
-colauthor=
-colcommitter=
-colfiles=
-colsignoff=
-coldefault=
-list_files=
-user=
-while [ "$1" ]; do
- # TODO: Parse -r here too.
- case "$1" in
- -c)
+unset colheader colauthor colcommitter colfiles colsignoff coldefault
+unset list_files log_start log_end files user
+
+while optparse; do
+ if optparse -c || optparse --color; then
# See terminfo(5), "Color Handling"
colheader="$(tput setaf 2)" # Green
colauthor="$(tput setaf 6)" # Cyan
@@ -49,21 +42,28 @@
colfiles="$(tput setaf 4)" # Blue
colsignoff="$(tput setaf 3)" # Yellow
coldefault="$(tput op)" # Restore default
- shift
- ;;
- -f)
+ elif optparse -f || optparse --file-list; then
list_files=1
- shift
- ;;
- -u*)
- user="${1#-u}"
- shift
- ;;
- *)
- break
- ;;
- esac
+ elif optparse -u= || optparse --user=; then
+ user=$opts
+ optshift
+ elif optparse -r= || optparse --revision=; then
+ if [ set != "${log_start+set}" ]; then
+ log_start=$opts
+ if [[ "$log_start" == *:* ]]; then
+ log_end=${log_start#*:}
+ log_start=${log_start%:*}
+ fi
+ else
+ [ set != "${log_end+set}" ] || die "too many revisions"
+ log_end=$opts
+ fi
+ optshift
+ else
+ die "unrecognized option \`$opts'"
+ fi
done
+shift $(( $# - ${#opts[*]} ))
list_commit_files()
{
@@ -92,24 +92,7 @@
echo "$coldefault:"
}
-log_start=
-log_end=
-if [ "$1" = "-r" ]; then
- shift
- log_start="$1"
- shift
- if echo "$log_start" | grep -q ':'; then
- log_end=$(echo "$log_start" | cut -d : -f 2)
- log_start=$(echo "$log_start" | cut -d : -f 1)
- fi
-fi
-if [ "$1" = "-r" ]; then
- shift
- log_end="$1"
- shift
-fi
-
-if [ "$log_end" ]; then
+if [ set = "${log_end+set}" ]; then
id1="$(commit-id $log_start)" || exit 1
id2="$(commit-id $log_end)" || exit 1
revls="git-rev-tree $id2 ^$id1"
^ permalink raw reply
* Re: [PATCH] improved delta support for git
From: Chris Mason @ 2005-05-13 11:44 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Nicolas Pitre, jon, Git Mailing List
In-Reply-To: <7vbr7gicv8.fsf@assigned-by-dhcp.cox.net>
On Thursday 12 May 2005 13:16, Junio C Hamano wrote:
> >>>>> "NP" == Nicolas Pitre <nico@cam.org> writes:
> >>
> >> On 5/13/05, Chris Mason <mason@suse.com> wrote:
> >> > On Thursday 12 May 2005 00:36, Junio C Hamano wrote:
> >> > > It appears to me that changes to the make_sure_we_have_it() ...
> >> >
> >> > If we fetch the named object and it is a delta, the delta will either
> >> > depend on an object we already have or an object that we don't have.
> >> > If we don't have it, the pull should find it while pulling other
> >> > commits we don't have.
>
> NP> 1) If you happen to already have the referenced object in your local
> NP> repository then you're done.
>
> Yes.
>
> NP> 2) If not you pull the referenced object from the remote repository,
> NP> repeat with #1 if it happens to be another delta object.
>
> Yes, that is the outline of what my (untested) patch does.
>
> Unless I am grossly mistaken, what Chris says is true only when
> we are pulling with -a flag to the git-*-pull family. If we are
> pulling "partially near the tip", we do not necessarily pull
> "other commits we don't have", hence detecting delta's
> requirement at per-object level and pulling the dependent
> becomes necessary, which is essentially what you wrote in (2)
> above.
>
Yes, my post does assume that you're pulling everything and the repo you're
pulling from has a sane state. This should be the common case though, so I
would suggest optimizing things to build a list of the delta objects and
check them at the end to see if we didn't pull any.
We want the list of delta objects regardless, this way we can warn the user
that they have pulled in deltas and give them the chance to convert them into
full files.
-chris
^ permalink raw reply
* Re: gitweb wishlist
From: Jonas Fonseca @ 2005-05-13 12:06 UTC (permalink / raw)
To: Kay Sievers; +Cc: git
In-Reply-To: <20050511012626.GL26384@pasky.ji.cz>
I don't know if this is intentional, but it looks like gitweb discards
everything after the first line starting with 'Signed-off-by:' on the
log page. This will in some cases remove valuable log information when
a second author or the committer adds additional comments to a commit:
<log message by author>
Signed-off-by: <author>
<log message by committer>
Signed-off-by: <committer>
The commit page gets it right, which is why I suspect it might just be a
way to trim the amount of text on the log page.
I also noticed that there is a 'faulty' signed-off-by line in commit
14ebb908e10f068dc1901d35f4b716bc69143d19 in case the above is
intentional. Dunno if that should be matched by relaxing the regexp a
little.
--
Jonas Fonseca
^ permalink raw reply
* cg-init
From: Morten Welinder @ 2005-05-13 13:32 UTC (permalink / raw)
To: Petr "Pasky" Baudis, GIT Mailing List
1. This still doesn't work from an empty directory.
2. The rm/cp/mkdir/touch will not work if $_git starts with a dash.
Lots of -- needed.
Morten
^ permalink raw reply
* Re: Adapting scripts to work in current (not top) directory
From: Petr Baudis @ 2005-05-13 13:53 UTC (permalink / raw)
To: Alexey Nezhdanov; +Cc: git
In-Reply-To: <200505131459.08891.snake@penza-gsm.ru>
Dear diary, on Fri, May 13, 2005 at 12:59:08PM CEST, I got a letter
> I have opted for current directory and not root. Explanation is later this
> mail. New variant:
Yes, that's fine.
> =========================
> --- /home/snake/scm/cogito/cg-Xlib 2005-05-12 08:47:29.000000000 +0400
> +++ cg-Xlib 2005-05-13 13:40:58.000000000 +0400
> @@ -8,7 +8,17 @@
>
> _cg_cmd=${0##*/}
>
> -_git=${GIT_DIR:-.git}
> +repopath=`pwd`
> +while ((1)) ; do {
> + [ -d "$repopath/.git" ] && break
> + [ "$repopath" == "/" ] && {
> + repopath=`pwd`;
> + break;
> + };
> + repopath=`dirname $repopath`
> +}; done
> +
> +_git=${GIT_DIR:-$repopath/.git}
> _git_objects=${GIT_OBJECT_DIRECTORY:-$_git/objects}
Looks basically fine.
> =========================
> Here is a problem:
> Because of git backend only some of the commands should be enabled to work
> from current directory. F.e. cg-init should not scan upper directories for
> ".git" but should instead stick to current directory. In the script above
> this workarounded as choosing current directory instead of root but this will
> broke if we trying to initialise repo in a subdirectory of another repo.
I'd set some flag like $reposubdir if .git was found in some of the
parent directories. Then test that in the relevant commands.
> So I have analysed list of cogito commands to find out which ones should be
> adopted to use "find repo" behaivoir:
>
> "+" means "definitely yes"
> "-" means "definitely no"
> "?" means "not sure"
> "." means "not matter"
>
> + cg-add
> ? cg-admin-lsobj
Sure.
> - cg-admin-uncommit
> ? cg-branch-add
> ? cg-branch-ls
Sure (both).
> - cg-cancel
> - cg-clone
> - cg-commit
This one should, committing only the subdirectory content.
> + cg-diff
> - cg-export
Perhaps it could export just the subdirectory?
> . cg-help
> - cg-init
> + cg-log
> + cg-ls
(Listing the appropriate subdir.)
> - cg-merge
> + cg-mkpatch
> ? cg-patch
This one should, using the appropriate -p level.
> - cg-pull
> - cg-restore
This one should, restoring only the subdirectory.
> + cg-rm
> - cg-seek
> + cg-status
> - cg-tag
> ? cg-tag-ls
Why not...
> - cg-update
> . cg-version
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* [ANNOUNCE] mtkdiff 20050513
From: Tejun Heo @ 2005-05-13 13:56 UTC (permalink / raw)
To: git, linux-kernel
Hello, guys.
Here's mtkdiff 20050513. Changes are
* tarball name changed to mtkdiff from gitkdiff
* gitkdiff modified to use the new git-* commands
* gitkdiff no automtically locates git repository root, so you can
execute it from any sub-directory.
* quiltkdiff added. It shows all the patches in the series with
mtkdiff.
* gitgrep added. This isn't really related to mtkdiff or git, but
I use it all the time and didn't wanna put it separately. :-)
http://home-tj.org/mtkdiff/files/mtkdiff-20050513.tar.gz
Thanks.
--
tejun
^ permalink raw reply
* Re: [RFC] Embedding asciidoc manpages in the cg scripts
From: Jonas Fonseca @ 2005-05-13 18:48 UTC (permalink / raw)
To: Petr Baudis; +Cc: David Greaves, git
In-Reply-To: <20050511224806.GJ22686@pasky.ji.cz>
[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]
Petr Baudis <pasky@ucw.cz> wrote Thu, May 12, 2005:
> Dear diary, on Thu, May 12, 2005 at 12:20:10AM CEST, I got a letter
> where David Greaves <david@dgreaves.com> told me that...
> > Petr Baudis wrote:
> >
> > >>+# NAME
> > >>+# ----
> > >>+# cg-add - add files to a GIT repository
> > >
> > >Half of this is useless, too.
> > >
> > >I think you should just keep the first paragraph of the files as it is
> > >now. Don't touch it, just parse it.
> > >
> > A bit harsh Petr.
>
> Sorry, I didn't mean to sound (too) harsh. ;-)
Don't mind that you are harsh if it makes sense and I must agree that
having a helper script really paid off reducing the added markup to
almost a half (in my initial patches). Plus, it is now easy to enhance
the manpages with links to referenced commands without having stuff like
'link:' markup in the script headers.
I ended up actually adding two scripts. One for lifting cg-* manpages
and one for generating a cogito manpage with an overview of commands and
information about command identifiers.
The generated manpages can be previewed at:
http://www.nitro.dk/~jonas/cogito/manpages/cogito.html
--
Jonas Fonseca
[-- Attachment #2: cogito-manpages.patch --]
[-- Type: text/plain, Size: 43608 bytes --]
[PATCH] Cogito manpages
Add asciidoc markup to Cogito script headers. Add a script to generate
asciidoc manpages from the cg-* command headers and a script for
generating a cogito(1) manpage. Finally, add build rules for making
Cogito manpages.
Notes:
* USAGE variables are added which can later be used by cg-help or die().
* The command identifiers are name wrapped in '<'/'>' like in the GIT
manpages and are not similar to those in cg-help.
* The top-level Makefile is changed to add a script header to cg-version
so it could also have a man pages. Don't know if that belongs there or
in Documentation/cg-version.txt. Anyway, in order to minimize the
patch I cleaned up the checking of .git/HEAD.
* I had trouble getting asciidoc to accept the line
git+ssh://[user@]host/path
I couldn't figure out how to escape it so I changed it to
git+ssh://host/path or git+ssh://user@host/path
Finally the example with referencing branches via #fragments I shortened
the rsync URL so the line breaking '\' was not needed.
* The description of -r options should be carefully reviewed. I changed
them to be more alike across cg-{diff,log,mkpatch} and some of the
original ones looked wrong.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
Documentation/Makefile | 11 ++
Documentation/make-cg-manpage | 65 ++++++++++++++++
Documentation/make-cogito-manpage | 149 ++++++++++++++++++++++++++++++++++++++
Makefile | 33 +++++---
cg-add | 18 ++++
cg-admin-lsobj | 35 +++++++-
cg-admin-uncommit | 28 ++++---
cg-branch-add | 44 ++++++-----
cg-branch-ls | 19 ++++
cg-cancel | 19 +++-
cg-clone | 17 +++-
cg-commit | 95 +++++++++++++++++++-----
cg-diff | 29 +++++--
cg-export | 15 +++
cg-help | 17 ++++
cg-init | 15 +++
cg-log | 71 +++++++++++++-----
cg-ls | 35 ++++++++
cg-merge | 25 ++++--
cg-mkpatch | 39 ++++++++-
cg-patch | 11 ++
cg-pull | 15 +++
cg-restore | 24 ++++--
cg-rm | 11 ++
cg-seek | 26 ++++--
cg-status | 30 +++++++
cg-tag | 15 +++
cg-tag-ls | 9 ++
cg-update | 16 +++-
29 files changed, 785 insertions(+), 151 deletions(-)
Index: Documentation/Makefile
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/Documentation/Makefile (mode:100644)
+++ uncommitted/Documentation/Makefile (mode:100644)
@@ -1,4 +1,7 @@
-DOC_SRC=$(wildcard git*.txt)
+CG_IGNORE=$(wildcard ../cg-X*)
+CG_SRC=$(filter-out $(CG_IGNORE), $(wildcard ../cg-*))
+CG_TXT=cogito.txt $(patsubst ../cg-%,cg-%.txt,$(CG_SRC))
+DOC_SRC=$(wildcard git*.txt) $(CG_TXT)
DOC_HTML=$(patsubst %.txt,%.html,$(DOC_SRC))
DOC_MAN=$(patsubst %.txt,%.1,$(DOC_SRC))
@@ -22,3 +25,9 @@
%.xml : %.txt
asciidoc -b docbook -d manpage $<
+
+cogito.txt : make-cogito-manpage
+ ./make-cogito-manpage > $@
+
+cg-%.txt : ../cg-% make-cg-manpage
+ ./make-cg-manpage $< > $@
Index: Documentation/make-cg-manpage
===================================================================
--- /dev/null (tree:de641904363cd3759f132ee7c0dfaf8a2ee58388)
+++ uncommitted/Documentation/make-cg-manpage (mode:100755)
@@ -0,0 +1,65 @@
+#!/usr/bin/env bash
+#
+# Generate asciidoc manpage markup from Cogito script header.
+# Copyright (c) Jonas Fonseca, 2005
+#
+# Takes a path to a Cogito script. Prints the manpage to stdout.
+
+. ${COGITO_LIB}cg-Xlib
+
+command=$1
+
+[ -e "$command" ] || die "$command does not exist"
+
+COMMAND=$(basename $command)
+
+# FIXME: Show the SHA1 of the command below the TITLELINE.
+
+# Generate the 'CG-COMMAND(1)' title from cg-command
+TITLE="$COMMAND(1)"
+# Asciidocs wants the title line ('====') to be as wide as the title.
+TITLELINE=$(echo "$TITLE" | sed 's/[0-9a-zA-Z-()]/=/g')
+
+# Get `USAGE="cg-command args..."` line and make it `cg-command args...`
+SYNOPSIS=$(grep 'USAGE=' $command | sed 's/^USAGE="\(.*\)"/\1/')
+
+# Extract the script header.
+HEADER=$(cat $command | sed -n '3,/^$/s/^# *//p')
+
+# Some scripts have copyright lines followed by 'Based on script by ...' lines.
+# Include them so they are also put in the COPYRIGHT section.
+COPYRIGHT=$(cat $command | sed -n '3,/^$/s/^# *//p' \
+ | sed -n '/^Copyright (c)/,/^$/p' \
+ | sed 's/(c)/(C)/')
+
+# First line of the header contains the caption. Normalize it by lowercasing the
+# start and stripping any punctuation.
+CAPTION=$(echo "$HEADER" | head -n 1 | tr '[A-Z]' '[a-z]' | sed 's/\.$//')
+
+# Get remaining sections and carefully insert links to cogito commands when they
+# were referenced as "`cg-command`". Note, we can't just do it for any cg-*
+# combo because code listings will ignore any asciidoc markup...."
+BODY=$(echo "$HEADER" | sed -n '/^DESCRIPTION$/,$p' \
+ | sed 's/`\(cg-[a-z-]\+\)`/link:\1.html[`\1(1)`]/')
+
+echo "$TITLE"
+echo "$TITLELINE"
+echo
+echo "NAME"
+echo "----"
+echo "$COMMAND - $CAPTION"
+echo
+echo "SYNOPSIS"
+echo "--------"
+echo "$SYNOPSIS"
+echo
+echo "$BODY"
+echo
+echo "COPYRIGHT"
+echo "---------"
+echo "$COPYRIGHT"
+echo
+echo "SEE ALSO"
+echo "--------"
+echo "$COMMAND command is part of link:cogito.html[cogito(1)],"
+echo "a toolkit for managing link:git.html[git(1)] trees."
Index: Documentation/make-cogito-manpage
===================================================================
--- /dev/null (tree:de641904363cd3759f132ee7c0dfaf8a2ee58388)
+++ uncommitted/Documentation/make-cogito-manpage (mode:100755)
@@ -0,0 +1,149 @@
+#!/usr/bin/env bash
+#
+# Generate a quick reference asciidoc manpage for the Cogito.
+# Copyright (c) Jonas Fonseca, 2005
+
+# Shorthand for the link markup.
+link()
+{
+ command="$1"
+ echo "link:$command.html[\`$command(1)\`]"
+}
+
+# Print description list entry.
+print_command_info()
+{
+ command="$1"
+ caption=$(cat "$command" | head -n 3 | tail -n 1 | sed 's/# //')
+ usage=$(grep 'USAGE=' "$command" | sed 's/^USAGE="\(.*\)"/\1/')
+ cmdname=$(basename $command)
+
+ echo
+ case "$cmdname" in
+ cg-*)
+ link "$cmdname"
+ ;;
+ *-id)
+ echo "$cmdname::"
+ ;;
+ esac
+ echo " $caption"
+ echo
+ echo " $usage"
+}
+
+cat <<__END__
+cogito(1)
+=========
+
+NAME
+----
+cogito - SCM-like GIT layer
+
+SYNOPSIS
+--------
+cg-<command> <arg>...
+
+DESCRIPTION
+-----------
+
+Cogito is a revision control system for tracking changes to content in a
+highly distributed development environment. Amongst some of the noteworthy
+features, Cogito has support for branching, tagging and multiple backends for
+distributing repositories (local files, rsync, HTTP, ssh).
+
+Cogito is implemented as a series of \`bash(1)\` scripts on top of $(link git)
+(a stupid content tracker) with the goal of providing an interface for working
+with the GIT database in a manner similar to other SCM tools (like CVS,
+BitKeeper or Monotone).
+
+Commands Overview
+-----------------
+
+The Cogito commands can be split into regular commands and advanced commands.
+The regular commands are those used for normal interacting with the
+repository, while the advanced commands can be used for administrating the
+repository and should to some degree be regarded as low-level and in some
+cases dangerous.
+
+Below an overview of the available commands are listed. For details on
+individual commands, do e.g. \`cg-help cg-log\` or \`cg-log --help\`.
+
+Regular commands
+~~~~~~~~~~~~~~~~
+__END__
+
+for command in $(ls ../cg-* | grep -v cg-admin- | grep -v cg-X); do
+ print_command_info "$command"
+done
+
+cat <<__END__
+
+Advanced commands
+~~~~~~~~~~~~~~~~~
+__END__
+
+for command in $(ls ../cg-admin-*); do
+ print_command_info "$command"
+done
+
+cat <<__END__
+
+Helper commands
+~~~~~~~~~~~~~~~
+
+Cogito also provides various helper commands for resolving IDs for symbolic
+names etc. The commands are:
+__END__
+
+for command in $(ls ../*-id | grep -v git-); do
+ print_command_info "$command"
+done
+
+cat <<__END__
+
+Command Identifiers
+-------------------
+<branch>::
+ Indicates a branch name added with the $(link cg-branch-add) name.
+
+<command>::
+ Indicates a Cogito command. The \`cg-\` prefix is optional.
+
+<location>::
+ Indicates a local file path or a URI. See $(link cg-branch-add) for a
+ list of supported URI schemes.
+
+<revision>::
+ Indicates an ID resolving to a commit. The following expressions can
+ be used interchangably as IDs:
+ - empty string, 'this' or 'HEAD' (current HEAD)
+ - branch name (as registered with $(link cg-branch-add))
+ - tag name (as registered with $(link cg-tag))
+ - shortcut object hash (shorted unambiguous hash lead)
+ - commit object hash (as returned by \`commit-id\`)
+ - tree object hash (as returned by \`tree-id\`)
+
+<tag>::
+ Indicates a free form tag name.
+
+<type>::
+ Indicates a git object type i.e.: \`blob\`, \`commit\`, \`tree\` or
+ \`tag\`.
+
+<username>::
+ Indicates a free form user name.
+
+<file>::
+ Indicates a filename - always relative to the root of the repository.
+
+AUTHORS
+-------
+Cogito was written by Petr Baudis <pasky@ucw.cz>.
+This manpage was written by Jonas Fonseca <fonseca@diku.dk>.
+
+COPYRIGHT
+---------
+Copyright (C) Petr Baudis, 2005.
+Copyright (C) Jonas Fonseca, 2005.
+__END__
Index: Makefile
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/Makefile (mode:100644)
+++ uncommitted/Makefile (mode:100644)
@@ -114,20 +114,33 @@
ifneq (,$(wildcard .git))
-cg-version: $(VERSION) .git/HEAD
- @echo Generating cg-version...
- @rm -f $@
- @echo "#!/bin/sh" > $@
- @echo "echo \"$(shell cat $(VERSION)) ($(shell cat .git/HEAD))\"" >> $@
- @chmod +x $@
-else
-cg-version: $(VERSION)
+GIT_HEAD=.git/HEAD
+GIT_HEAD_ID=" $(shell cat $(GIT_HEAD))"
+endif
+cg-version: $(VERSION) $(GITHEAD) Makefile
@echo Generating cg-version...
@rm -f $@
@echo "#!/bin/sh" > $@
- @echo "echo \"$(shell cat $(VERSION))\"" >> $@
+ @echo "#" >> $@
+ @echo "# Show the version of the Cogito toolkit." >> $@
+ @echo "# Copyright (c) Petr Baudis, 2005" >> $@
+ @echo "#" >> $@
+ @echo "# DESCRIPTION" >> $@
+ @echo "# -----------" >> $@
+ @echo "# Show which version of Cogito is installed." >> $@
+ @echo "# Additionally, the 'HEAD' of the installed Cogito" >> $@
+ @echo "# is also shown if this information was available" >> $@
+ @echo "# at the build time." >> $@
+ @echo "#" >> $@
+ @echo "# OPTIONS" >> $@
+ @echo "# -------" >> $@
+ @echo "# -h, --help::" >> $@
+ @echo "# Print usage help." >> $@
+ @echo >> $@
+ @echo "USAGE=\"cg-version\"" >> $@
+ @echo >> $@
+ @echo "echo \"$(shell cat $(VERSION))$(GIT_HEAD_ID)\"" >> $@
@chmod +x $@
-endif
git.spec: git.spec.in $(VERSION)
sed -e 's/@@VERSION@@/$(shell cat $(VERSION) | cut -d"-" -f2)/g' < $< > $@
Index: cg-add
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-add (mode:100755)
+++ uncommitted/cg-add (mode:100755)
@@ -1,10 +1,26 @@
#!/usr/bin/env bash
#
-# Add new file to a GIT repository.
+# Add files to the GIT repository.
# Copyright (c) Petr Baudis, 2005
#
+# DESCRIPTION
+# -----------
# Takes a list of file names at the command line, and schedules them
# for addition to the GIT repository at the next commit.
+#
+# The command will fail if one of the given files does not exist.
+#
+# Note that cogito manage content. Which means it doesn't make sense
+# to `cg-add` stand-alone directories since directories have no content.
+# Instead add a file within the new directory and `cg-add` will create
+# a tree for managing the directory as needed.
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-add <file>..."
. ${COGITO_LIB}cg-Xlib
Index: cg-admin-lsobj
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-admin-lsobj (mode:100755)
+++ uncommitted/cg-admin-lsobj (mode:100755)
@@ -4,17 +4,44 @@
# Copyright (c) Randy Dunlap, 2005
# Copyright (c) Petr Baudis, 2005
#
-# Lists IDs of all the objects of a given type (blob, tree, commit) found
-# in the dircache.
+# DESCRIPTION
+# -----------
+# Lists IDs of all the objects of a given type found in the dircache.
+# Takes the object type as the first parameter, defaults to all objects.
+#
+# The possible object types are:
+# `blob`::
+# This object is a pure storage object containing some user data.
+#
+# `commit`::
+# This object ties directory hierarchies together into a DAG
+# of revisions.
+#
+# `tree`::
+# This object is an object that ties one or more `blob` objects
+# into a directory structure.
+#
+# `tag`::
+# This object ties a symbolic release tag to an object in the
+# database.
#
-# Example usage:
+# See the git README for more information about the object types.
+#
+# EXAMPLE USAGE
+# -------------
# Oh, I was messing with my HEADs and lost few commits, where on the earth
# could they be...?
+#
# for i in `cg-admin-lsobj commit | cut -f 1`; do
# echo -e "\n==================\nme $i"; cat-file commit $i;
# done
#
-# Takes the object type as the first parameter, defaults to all objects.
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-admin-lsobj [<type>]"
. ${COGITO_LIB}cg-Xlib
Index: cg-admin-uncommit
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-admin-uncommit (mode:100755)
+++ uncommitted/cg-admin-uncommit (mode:100755)
@@ -1,18 +1,28 @@
#!/usr/bin/env bash
#
-# Undo a commit or a series of commits
+# Undo a commit or a series of commits.
# Copyright (c) Matt Porter, 2005
# Copyright (c) Petr Baudis, 2005
#
-# Optional -t parameter makes cg-admin-uncommit to roll back the tree
-# as well to the previous commit. Without this option (by default)
-# Cogito keeps the tree in its current state, therefore generating
-# tree with local changes against the target commit, consisting of the
-# changes in the rolled back commits.
+# DESCRIPTION
+# -----------
+# Takes a commit ID which is the earliest commit to be removed from
+# the repository. If no parameter is passed, it uncommits the latest
+# commit ('HEAD').
#
-# Takes a commit ID which is the earliest commit to be
-# removed from the repository. If no parameter is passed,
-# it uncommits the latest commit (HEAD).
+# OPTIONS
+# -------
+# -t::
+# This optional parameter makes `cg-admin-uncommit` to roll back
+# the tree as well to the previous commit. Without this option
+# (by default) Cogito keeps the tree in its current state,
+# therefore generating tree with local changes against the target
+# commit, consisting of the changes in the rolled back commits.
+#
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-admin-uncommit [-t] [<commit>]"
. ${COGITO_LIB}cg-Xlib
Index: cg-branch-add
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-branch-add (mode:100755)
+++ uncommitted/cg-branch-add (mode:100755)
@@ -3,35 +3,41 @@
# Add new branch to the GIT repository.
# Copyright (c) Petr Baudis, 2005
#
-# After you add a branch, you can cg-pull it whenever you want
-# and it will keep your objects database in sync with it. Its latest
-# commit is accessible as .git/refs/heads/branchname (or - more conveniently
-# - as $(commit-id branchname)). For example, to make a diff between
-# Linus (after you added him) and your current tree, do
-#
-# cg-pull linus
-# cg-diff linus
+# DESCRIPTION
+# -----------
+# Takes the branch name and source location as parameters.
+# After you add a branch, you can `cg-pull` it whenever you want and
+# it will keep your objects database in sync with it. Its latest
+# commit is accessible as `.git/refs/heads/branchname` (or - more
+# conveniently - as `$(commit-id branchname)`). For example, to make a
+# diff between Linus (after you added him) and your current tree, do:
#
+# $ cg-pull linus
+# $ cg-diff linus
#
# The possible location specifiers are:
#
-# (1) Local path - note that pulling will hardlink the objects, not copy them.
-# (2) rsync - either rsync://host/path or host:/path (the latter can change)
-# (3) HTTP - http://host/path
-# (4) SSH - git+ssh://[user@]host/absolute/path
+# 1. Local path - note that pulling will hardlink the objects, not copy them.
+# 2. rsync - either `rsync://host/path` or `host:/path` (the latter can change)
+# 3. HTTP - `http://host/path`
+# 4. SSH - `git+ssh://host/path` or `git+ssh://user@host/path` - note that
+# the path must be absolute.
#
# The URL can have a fragment part, which identifies a branch inside of
# the repository. Therefore, if you have a repository
-# rsync://kernel.org/pub/scm/linux/kernel/mj/linux.git and you are interested
-# in its 'testing' branch, you can e.g.
-#
-# cg-branch-add mj-testing \
-# rsync://kernel.org/pub/scm/linux/kernel/mj/linux.git#testing
+# `rsync://host/path/repo.git` and you are interested in its 'testing'
+# branch, you can e.g.:
#
-# and refer to it as 'mj-testing' anytime later.
+# $ cg-branch-add repo-testing rsync://host/path/repo.git#testing
#
+# and refer to it as 'repo-testing' anytime later.
#
-# Takes the branch' name and location as parameters.
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-admin-uncommit <branch> <location>"
. ${COGITO_LIB}cg-Xlib
Index: cg-branch-ls
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-branch-ls (mode:100755)
+++ uncommitted/cg-branch-ls (mode:100755)
@@ -3,7 +3,24 @@
# List configured GIT branches.
# Copyright (c) Steven Cole 2005
#
-# Takes no parameters.
+# DESCRIPTION
+# -----------
+# Print a listing of all known branches.
+#
+# The output has the following format:
+#
+# <branch> <location>
+#
+# For example
+#
+# origin rsync://rsync.kernel.org/pub/scm/cogito/cogito.git
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-branch-ls"
. ${COGITO_LIB}cg-Xlib
Index: cg-cancel
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-cancel (mode:100755)
+++ uncommitted/cg-cancel (mode:100755)
@@ -3,16 +3,23 @@
# Cancels current edits in the working tree.
# Copyright (c) Petr Baudis, 2005
#
-# This script reverts the working tree to a consistent state before
-# any changes to it (including merges etc) were done.
+# DESCRIPTION
+# -----------
+# Reverts the working tree to a consistent state before any changes to it
+# (including merges etc.) were done.
#
-# Basically, this is the opposite of cg-commit in some sense.
+# Basically, this is the opposite of `cg-commit` in some sense.
#
-# Takes no arguments and the evil changes from the tree.
-#
-# This command is complementary to cg-restore, which only brings
+# This command is complementary to `cg-restore`, which only brings
# individual files in sync with their state at the time of the
# last commit.
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help
+
+USAGE="cg-cancel"
. ${COGITO_LIB}cg-Xlib
Index: cg-clone
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-clone (mode:100755)
+++ uncommitted/cg-clone (mode:100755)
@@ -3,16 +3,25 @@
# Clone a remote GIT repository.
# Copyright (c) Petr Baudis, 2005
#
+# DESCRIPTION
+# -----------
# This is like cg-init, but it will create a new directory where it will do
# the checkout.
#
-# If you pass it an optional -s parameter, it does the clone in the current
-# directory instead of creating a new one.
-#
# Takes a parameter specifying the location of the source repository and an
-# optional second parameter specifying the destination. If the second
+# optional second parameter specifying the destination. If the second
# parameter is omitted, the basename of the source repository is used as the
# destination.
+#
+# OPTIONS
+# -------
+# -s::
+# Clone in the current directory instead of creating a new one.
+#
+# -h, --help::
+# Print usage help
+
+USAGE="cg-clone [-s] <location> [<directory>]"
. ${COGITO_LIB}cg-Xlib
Index: cg-commit
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-commit (mode:100755)
+++ uncommitted/cg-commit (mode:100755)
@@ -4,26 +4,81 @@
# Copyright (c) Petr Baudis, 2005
# Based on an example script fragment sent to LKML by Linus Torvalds.
#
-# Ignores any parameters for now, excepts changelog entry on stdin.
-# -C makes cg-commit ignore cache and just commit the thing as-is;
-# this is for internal purposes (merging).
-# -m"log message" specifies the commit message, which is used instead
-# of starting up an editor (if the input is not stdin, the input is
-# appended after all the -m messages). Multiple -m parameters are
-# appended to a single commit message, each as separate paragraph.
-# -e forces the editor to be brought up even when -m parameters were
-# passed to cg-commit.
-# -E forces the editor to be brought up and it will do the commit
-# even if the default commit message is not changed.
-#
-# These git environment variables are used in case values other than
-# that returned by getpwuid(getuid()) are desired when performing a commit:
-#
-# GIT_AUTHOR_NAME Author's name
-# GIT_AUTHOR_EMAIL Author's e-mail address
-# GIT_AUTHOR_DATE Date, perhaps from a patch e-mail
-# GIT_COMMITTER_NAME Committer's name
-# GIT_COMMITTER_EMAIL Committer's e-mail address
+#
+# DESCRIPTION
+# -----------
+# Commits changes to a GIT repository. Accepts the commit message from
+# `stdin`. If the commit message is not modified the commit will be
+# aborted.
+#
+# The `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`, `GIT_AUTHOR_DATE`,
+# `GIT_COMMITTER_NAME` and `GIT_COMMITTER_EMAIL` environment variables
+# are used in case values other than that returned by `getpwuid(getuid())`
+# are desired when performing a commit.
+#
+# OPTIONS
+# -------
+# -C::
+# Make `cg-commit` ignore the cache and just commit the thing as-is.
+# Note, this is used internally by Cogito when merging. This option
+# does not make sense when files are given on the command line.
+#
+# -m<message>::
+# Specify the commit message, which is used instead of starting
+# up an editor (if the input is not `stdin`, the input is appended
+# after all the '-m' messages). Multiple '-m' parameters are appended
+# to a single commit message, each as separate paragraph.
+#
+# -e::
+# Force the editor to be brought up even when '-m' parameters were
+# passed to `cg-commit`.
+#
+# -E::
+# Force the editor to be brought up and do the commit even if
+# the default commit message is not changed.
+#
+# -h, --help::
+# Print usage help.
+#
+# FILES
+# -----
+# $GIT_DIR/commit-template::
+# If the file exists it will be used as a template when creating
+# the commit message. The template file makes it possible to
+# automatically add `Signed-off-by` line to the log message.
+#
+# $GIT_DIR/hooks/commit-post::
+# If the file exists and is executable it will be executed upon
+# completion of the commit. The script is passed two arguments.
+# The first argument is the commit ID and the second is the
+# branchname. A sample `commit-post` script might look like:
+#
+# #!/bin/sh
+# id=$1
+# branch=$2
+# echo "Committed $id in $branch" | mail user@host
+#
+# ENVIRONMENT VARIABLES
+# ---------------------
+# GIT_AUTHOR_NAME::
+# Author's name
+#
+# GIT_AUTHOR_EMAIL::
+# Author's e-mail address
+#
+# GIT_AUTHOR_DATE::
+# Date, useful when applying patches an e-mail
+#
+# GIT_COMMITTER_NAME::
+# Committer's name
+#
+# GIT_COMMITTER_EMAIL::
+# Committer's e-mail address
+#
+# EDITOR::
+# The editor used for entering revision log information.
+
+USAGE="cg-commit [-m<message>]... [-e | -E] [<file>]..."
. ${COGITO_LIB}cg-Xlib
Index: cg-diff
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-diff (mode:100755)
+++ uncommitted/cg-diff (mode:100755)
@@ -3,18 +3,29 @@
# Make a diff between two GIT trees.
# Copyright (c) Petr Baudis, 2005
#
+# DESCRIPTION
+# -----------
+# Outputs a diff for converting the first tree to the second one.
# By default compares the current working tree to the state at the
-# last commit. You can specify -r rev1:rev2 or -r rev1 -r rev2 to
-# tell it to make a diff between the specified revisions. If you
-# do not specify a revision, the current working tree is implied
-# (note that no revision is different from empty revision - -r rev:
-# compares between rev and HEAD, while -r rev compares between rev
-# and working tree).
+# last commit.
#
-# -p instead of one ID denotes a parent commit to the specified ID
-# (which must not be a tree, obviously).
+# OPTIONS
+# -------
+# -p::
+# Instead of one ID denotes a parent commit to the specified ID
+# (which must not be a tree, obviously).
#
-# Outputs a diff converting the first tree to the second one.
+# -r <commit>[:<commit>]::
+# Specify the revisions to diff using either '-r rev1:rev2' or
+# '-r rev1 -r rev2'. If no revision is specified, the current
+# working tree is implied. Note that no revision is different from
+# empty revision which means '-r rev:' compares between 'rev' and
+# 'HEAD', while '-r rev' compares between 'rev' and working tree.
+#
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-diff [-p] [-r <commit>[:<commit>]] [<file>]..."
. ${COGITO_LIB}cg-Xlib
Index: cg-export
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-export (mode:100755)
+++ uncommitted/cg-export (mode:100755)
@@ -3,12 +3,21 @@
# Exports a particular revision from a GIT repository.
# Copyright (c) Johannes E. Schindelin, 2005
#
-# Takes a destination and optionally an id as a parameter,
-# defaulting to HEAD.
+# DESCRIPTION
+# -----------
+# Takes a destination and optionally a tree ID as a parameter,
+# defaulting to 'HEAD'.
#
-# The destination can be either a .tar, .tar.gz, .tar.bz2 or .tgz
+# The destination can be either a `.tar`, `.tar.gz`, `.tar.bz2` or `.tgz`
# for generating a tarball. Other destination specifiers are assumed
# to be directory names, and the tree is exported to the given directory.
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-export <destination> [<tree>]"
. ${COGITO_LIB}cg-Xlib
Index: cg-help
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-help (mode:100755)
+++ uncommitted/cg-help (mode:100755)
@@ -1,9 +1,24 @@
#!/usr/bin/env bash
#
-# The help for the Cogito toolkit.
+# Show help for Cogito commands.
# Copyright (c) Petr Baudis, 2005
#
+# DESCRIPTION
+# -----------
# Takes an optional argument describing the command to show the help for.
+# The command can be specified either as '<command>' or 'cg-<command>'.
+# If the argument is left out an overview of all the Cogito commands will
+# be shown.
+#
+# Note help for a command is also available by passing `--help` or `-h`
+# to the command.
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help
+
+USAGE="cg-help [<command>]"
. ${COGITO_LIB}cg-Xlib
Index: cg-init
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-init (mode:100755)
+++ uncommitted/cg-init (mode:100755)
@@ -3,10 +3,19 @@
# Initialize a GIT repository.
# Copyright (c) Petr Baudis, 2005
#
+# DESCRIPTION
+# -----------
# Takes an optional parameter which will make it "clone" a specified
-# remote repository. Note that this usage is DEPRECATED - use cg-clone
-# (possibly with the -s parameter) for doing this. This functionality
-# will go away from cg-init soon.
+# remote repository. Note that this usage is 'DEPRECATED'. Instead use
+# `cg-clone` (possibly with the `-s` parameter) for doing this. This
+# functionality will go away from `cg-init` soon.
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-init"
. ${COGITO_LIB}cg-Xlib
Index: cg-log
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-log (mode:100755)
+++ uncommitted/cg-log (mode:100755)
@@ -4,26 +4,59 @@
# Copyright (c) Petr Baudis, 2005.
# Copyright (c) David Woodhouse, 2005.
#
-# Takes a -c option to add color to the output.
-# Currently, the colors are:
+# DESCRIPTION
+# -----------
+# Display log information for files or a range of commits. The output
+# will automatically be displayed in a pager unless it is piped to
+# a program.
+#
+# OPTIONS
+# -------
+# Arguments not interpreted as options will be interpreted as filenames;
+# cg-log then displays only changes in those files.
+#
+# -c::
+# Add color to the output. Currently, the colors are:
+# - `author`: 'cyan'
+# - `committer`: 'magenta'
+# - `header`: 'green'
+# - `files`: 'blue'
+# - `signoff`: 'yellow'
+#
+# -f::
+# List which files changed.
+#
+# -r <commit>[:<commit>]::
+# Limit the log information to a set of revisions using either
+# '-r FROM_ID[:TO_ID]' or '-r FROM_ID -r TO_ID'. In both cases the
+# option expects IDs which resolve to commits and will include the
+# specified IDs. If 'TO_ID' is omitted all commits from 'FROM_ID'
+# to the initial commit is shown. If no revisions is specified,
+# the log information starting from 'HEAD' will be shown.
+#
+# -u<username>::
+# List only commits where author or committer contains '<username>'.
+# The search for '<username>' is case-insensitive.
+#
+# -h, --help::
+# Print usage help.
+#
+# EXAMPLE USAGE
+# -------------
+# To show a log of changes between two releases tagged as 'releasetag-0.9'
+# and 'releasetag-0.10' do:
+#
+# $ cg-log -r releasetag-0.9:releasetag-0.10
+#
+# ENVIRONMENT VARIABLES
+# ---------------------
+# PAGER::
+# The pager to display log information in, defaults to `less`.
#
-# header Green
-# author Cyan
-# committer Magenta
-# files Blue
-# signoff Yellow
-#
-# Takes an -f option to list which files was changed.
-#
-# Takes -u"username" to list only commits where author or
-# committer contains username.
-#
-# Takes an -r followed with id resolving to a commit to start from
-# (HEAD by default), or id1:id2 representing an (id1;id2] range
-# of commits to show.
-#
-# The rest of arguments are took as filenames; cg-log then displays
-# only changes in those files.
+# PAGER_FLAGS::
+# Flags to pass to the pager, defaults to `--R`
+
+USAGE="cg-log [-c] [-f] [-u<username>] [-r <commit>[:<commit>]] <file>..."
. ${COGITO_LIB}cg-Xlib
# Try to fix the annoying "Broken pipe" output. May not help, but apparently
Index: cg-ls
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-ls (mode:100755)
+++ uncommitted/cg-ls (mode:100755)
@@ -3,7 +3,40 @@
# List contents of a particular tree in a GIT repository.
# Copyright (c) Petr Baudis, 2005
#
-# Optionally takes commit or tree id as a parameter, defaulting to HEAD.
+# DESCRIPTION
+# -----------
+# Optionally takes a commit or tree ID as a parameter, defaulting to
+# 'HEAD'.
+#
+# Each line in the output has the following format:
+#
+# <mode> <type> <sha1> <name>
+#
+# where
+#
+# '<mode>'::
+# The file permission information in octal format.
+#
+# '<type>'::
+# The type can be the following: `blob` refers to files
+# and `tree` refers to directories.
+#
+# '<sha1>'::
+# The object ID.
+#
+# '<name>'::
+# The file or directory name.
+#
+# An example line might look like:
+#
+# 100644 blob c7dacd0ea28994e3c754ca4eadb2e08c011ee3d3 README
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-ls [<tree>]"
. ${COGITO_LIB}cg-Xlib
Index: cg-merge
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-merge (mode:100755)
+++ uncommitted/cg-merge (mode:100755)
@@ -3,15 +3,28 @@
# Merge a branch to the current tree.
# Copyright (c) Petr Baudis, 2005
#
+# DESCRIPTION
+# -----------
# Takes a parameter identifying the branch to be merged.
-# Optional "-b base_commit" parameter specifies the base for the merge.
-# Optional "-c" parameter specifies that you want to have tree merge
-# never autocomitted, but want to review and commit it manually.
#
-# You have to examine the tree after the merge and then do cg-commit.
+# You have to examine the tree after the merge and then do `cg-commit`.
#
-# Alternatively, it will just bring the HEAD forward, if your current
-# HEAD is also the merge base.
+# Alternatively, it will just bring the 'HEAD' forward, if your current
+# 'HEAD' is also the merge base.
+#
+# OPTIONS
+# -------
+# -b <commit>::
+# Parameter specifies the base commit for the merge.
+#
+# -c::
+# Parameter specifies that you want to have tree merge never
+# autocomitted, but want to review and commit it manually.
+#
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-merge [-c] [-b <commit>] <branch>"
. ${COGITO_LIB}cg-Xlib
Index: cg-mkpatch
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-mkpatch (mode:100755)
+++ uncommitted/cg-mkpatch (mode:100755)
@@ -1,14 +1,41 @@
#!/usr/bin/env bash
#
-# Make a patch from a given commit.
+# Make a patch from one or several commits.
# Copyright (c) Petr Baudis, 2005
#
-# Takes an -s option which specifies whether to print a short
-# version of the patch without a patch header with meta info such
-# as author and committer.
+# DESCRIPTION
+# -----------
+# Generate a patch with diff statistics and meta info about each commit.
#
-# Takes an -r followed with ID defaulting to HEAD, or id1:id2, forming
-# a range (id1;id2]. (Use "id1:" to take just everything from id1 to HEAD.)
+# OPTIONS
+# -------
+# -s::
+# Specify whether to print a short version of the patch without
+# a patch header with meta info such as author and committer.
+#
+# -r <commit>[:<commit>]::
+# Specify a set of commits to make patches from using either
+# '-r FROM_ID[:TO_ID]' or '-r FROM_ID -r TO_ID'. In both cases the
+# option expects IDs which resolve to commits and will include the
+# specified IDs. If 'TO_ID' is omitted patches for all commits
+# from 'FROM_ID' to the initial commit will be generated. If no
+# `-r` option is given the commit ID defaults to 'HEAD'.
+#
+# -h, --help::
+# Print usage help.
+#
+# EXAMPLE USAGE
+# -------------
+# To make patches for all commits between two releases tagged as
+# 'releasetag-0.9' and 'releasetag-0.10' do:
+#
+# $ cg-mkpatch -r releasetag-0.9:releasetag-0.10
+#
+# The output will be a contionuos dump of patches each separated by
+# the line
+# `!-------------------------------------------------------------flip-`
+
+USAGE="cg-mkpatch [-s] [-r <commit>[:<commit>]]"
. ${COGITO_LIB}cg-Xlib
Index: cg-patch
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-patch (mode:100755)
+++ uncommitted/cg-patch (mode:100755)
@@ -1,12 +1,21 @@
#!/usr/bin/env bash
#
-# Apply a diff generated by git diff.
+# Apply a diff generated by cg-diff.
# Copyright (c) Petr Baudis, 2005
#
+# DESCRIPTION
+# -----------
# This is basically just a smart patch wrapper. It handles stuff like
# mode changes, removal of files vs. zero-size files etc.
#
# Takes the diff on stdin.
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-patch < patch on stdin"
. ${COGITO_LIB}cg-Xlib
Index: cg-pull
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-pull (mode:100755)
+++ uncommitted/cg-pull (mode:100755)
@@ -1,11 +1,20 @@
#!/usr/bin/env bash
#
-# Pulls changes from remote branch to the local GIT repository.
-# Copyright (c) Petr Baudis, 2005
+# Pull changes from a remote branch to the local GIT repository.
+# Copyright (c) Petr Baudis, 2005.
+#
+# DESCRIPTION
+# -----------
+# Takes the branch name as an argument, defaulting to "origin".
#
# See cg-branch-add for some description.
#
-# Takes the branch' name, defaulting to "origin".
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-pull [<branch>]"
. ${COGITO_LIB}cg-Xlib
Index: cg-restore
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-restore (mode:100755)
+++ uncommitted/cg-restore (mode:100755)
@@ -1,21 +1,29 @@
#!/usr/bin/env bash
#
-# Restores files removed/changed in the working tree.
+# Restore removed/changed files in the working tree.
# Copyright (c) Petr Baudis, 2005
#
-# This script restores given files to their original state.
-#
-# Without any parameters, it recovers any files removed locally
-# whose removal was not recorded by cg-rm.
+# DESCRIPTION
+# -----------
+# Restore given files to their original state. Without any parameters,
+# it recovers any files removed locally whose removal was not recorded
+# by `cg-rm`.
#
# If passed a set of file names, it restores those files to their
-# state as of the last commit (including bringing cg-rm'd files
-# back to life; FIXME: does not do that part yet).
+# state as of the last commit (including bringing files removed with
+# `cg-rm` back to life; FIXME: does not do that part yet).
#
-# This command is complementary to the cg-cancel command, which
+# This command is complementary to the `cg-cancel` command, which
# forcefully abandons all the changes in the working tree and
# restores everything to a proper state (including unseeking,
# cancelling merge in progress and rebuilding indexes).
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-restore [<file>]..."
. ${COGITO_LIB}cg-Xlib
Index: cg-rm
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-rm (mode:100755)
+++ uncommitted/cg-rm (mode:100755)
@@ -1,10 +1,19 @@
#!/usr/bin/env bash
#
-# Remove a file from a GIT repository.
+# Remove files from a GIT repository.
# Copyright (c) Petr Baudis, 2005
#
+# DESCRIPTION
+# -----------
# Takes a list of file names at the command line, and schedules them
# for removal from the GIT repository at the next commit.
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-rm <file>..."
. ${COGITO_LIB}cg-Xlib
Index: cg-seek
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-seek (mode:100755)
+++ uncommitted/cg-seek (mode:100755)
@@ -3,22 +3,30 @@
# Seek the working tree to a given commit.
# Copyright (c) Petr Baudis, 2005
#
-# This will bring the working tree from its current HEAD to a given
-# commit. Note that it changes just the HEAD of the working tree, not
-# the branch it is corresponding to. It will return to the HEAD of
+# DESCRIPTION
+# -----------
+# Takes the target commit ID to seek to as an argument.
+# Seeking will bring the working tree from its current 'HEAD' to a given
+# commit. Note that it changes just the 'HEAD' of the working tree, not
+# the branch it is corresponding to. It will return to the 'HEAD' of
# the appropriate branch if passed no arguments.
#
# Therefore, for a quick excurse to the past of the 'master' branch:
#
-# cg-seek git-pasky-0.1
-# cg-diff this master # will do the correct thing
-# cg-seek # will restore what we had before
+# $ cg-seek git-pasky-0.1
+# $ cg-diff this master # will do the correct thing
+# $ cg-seek # will restore what we had before
#
-# For intuitiveness, specifying the branch name (cg-seek master) will do
+# For intuitiveness, specifying the branch name (`cg-seek master`) will do
# the right thing too. If you want to migrate your working tree to another
-# branch, use cg-fork.
+# branch, use `cg-fork`.
#
-# Takes the target commit ID.
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-seek <commit>"
. ${COGITO_LIB}cg-Xlib
Index: cg-status
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-status (mode:100755)
+++ uncommitted/cg-status (mode:100755)
@@ -3,7 +3,35 @@
# Show status of entries in your working tree.
# Copyright (c) Petr Baudis, 2005
#
-# Takes no arguments.
+# DESCRIPTION
+# -----------
+# Print of files in the working tree.
+#
+# The output has the following format:
+#
+# <status flag> <file>
+#
+# where '<status flag>' can be one of the following:
+#
+# `?`::
+# '<file>' is unknown.
+# `M`::
+# '<file>' has been touched or modified.
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+#
+# FILES
+# -----
+# $GIT_DIR/exclude::
+# If the file exists it will be used to prune which files to
+# show status for. The format is similar to the `dontdiff` file;
+# each line contains a pattern for a file or group of files
+# to exclude.
+
+USAGE="cg-status"
. ${COGITO_LIB}cg-Xlib
Index: cg-tag
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-tag (mode:100755)
+++ uncommitted/cg-tag (mode:100755)
@@ -3,10 +3,19 @@
# Mark certain commit by a tag.
# Copyright (c) Petr Baudis, 2005
#
-# Creates a tag referencing the given commit (or HEAD). You can then
-# use the tag anywhere you specify a commit/tree ID.
+# DESCRIPTION
+# -----------
+# Creates a tag referencing the given commit (or 'HEAD'). You can then
+# use the tag anywhere you specify a commit or tree ID.
#
-# Takes the tag's name and optionally the associated ID.
+# Takes the tag name and optionally the associated ID as arguments.
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-tag <tag> [<commit>]"
. ${COGITO_LIB}cg-Xlib
Index: cg-tag-ls
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-tag-ls (mode:100755)
+++ uncommitted/cg-tag-ls (mode:100755)
@@ -3,7 +3,16 @@
# List stored GIT tags.
# Copyright (c) Steve Hoelzer 2005
#
+# DESCRIPTION
+# -----------
# Takes no parameters.
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-tag-ls"
. ${COGITO_LIB}cg-Xlib
Index: cg-update
===================================================================
--- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-update (mode:100755)
+++ uncommitted/cg-update (mode:100755)
@@ -1,9 +1,21 @@
#!/usr/bin/env bash
#
-# Pulls changes from another branch to the local repository and merge changes.
+# Pull and merge changes from a branch to the local repository.
# Copyright (c) Petr Baudis, 2005
#
-# Takes the branch' name, defaulting to "origin".
+# DESCRIPTION
+# -----------
+# Takes the branch name as an argument, defaulting to 'origin'.
+#
+# If local changes conflict with those of the branch updated from the
+# merge will be blocked.
+#
+# OPTIONS
+# -------
+# -h, --help::
+# Print usage help.
+
+USAGE="cg-update [<branch>]"
. ${COGITO_LIB}cg-Xlib
^ permalink raw reply
* Re: [PATCH 4/4] Pulling refs by ssh
From: H. Peter Anvin @ 2005-05-13 18:59 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: Petr Baudis, git, Linus Torvalds
In-Reply-To: <Pine.LNX.4.21.0505130258030.30848-100000@iabervon.org>
Daniel Barkalow wrote:
> Adds support for pulling refs by rsh.
>
> This changes the rsh protocol to allow requests for different things, and
> to allow the server to report that it doesn't have something without
> breaking the connection.
>
Use && rather than semicolon, and make sure you quote things that need
to be quoted.
-hpa
^ permalink raw reply
* Re: [PATCH 0/4] Pulling refs files
From: Petr Baudis @ 2005-05-13 22:19 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: git, Linus Torvalds
In-Reply-To: <Pine.LNX.4.21.0505130245260.30848-100000@iabervon.org>
Dear diary, on Fri, May 13, 2005 at 08:49:25AM CEST, I got a letter
where Daniel Barkalow <barkalow@iabervon.org> told me that...
> This series makes the following changes:
>
> 1: Adds support for having the C code know about the general existance of
> .git/refs, and functions for writing these files.
> 2: Adds support in the generic pull code for fetching refs (and dummy
> implementations).
> 3: Adds support in the HTTP pull code for fetching refs
> 4: Adds support in the rsh pull code for fetching refs; this requires
> changes to the protocol. These changes should be sufficient to support
> any future extension, however.
Hmm, I've honestly expected something different - a generic way to
specify any file in the repository to be pulled along, instead of a
introducing refs awareness at this level of git. What would be the
advantages of that approach against just specifying list of other files
to pull along?
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* Re: [PATCH] update README and #include in git.txt
From: Petr Baudis @ 2005-05-13 22:13 UTC (permalink / raw)
To: David Greaves; +Cc: GIT Mailing Lists
In-Reply-To: <4283CB19.3050208@dgreaves.com>
Dear diary, on Thu, May 12, 2005 at 11:31:05PM CEST, I got a letter
where David Greaves <david@dgreaves.com> told me that...
> Makefile understands the includes git.txt #includes README
> README reformatted to asciidoc to allow inclusion in git.txt
>
> Signed-off-by: David Greaves <david@dgreaves.com>
Is it just me or this commit message is really weird? :-)
> Index: README
> ===================================================================
> --- 3c79088f1832d78012ccdb63e5da1ab88fcf408e/README (mode:100644)
> +++ e0e578bb02a7d8db1c105fddf5b5168ad0c79088/README (mode:100644)
> @@ -1,9 +1,13 @@
> +////////////////////////////////////////////////////////////////
> + GIT - the stupid content tracker
>
>
> -
> - GIT - the stupid content tracker
> +Note that this README is written in asciidoc format and is #include'd
> +in the git.txt docs
>
>
> +The rest of this README is #included in the git.txt file
> +////////////////////////////////////////////////////////////////
> "git" can mean anything, depending on your mood.
>
> - random three-letter combination that is pronounceable, and not
I'd probably prefer this being much less prominent. Can it be rather at
the bottom of the file?
> -the object (i.e. how it is used, and how it can refer to other objects).
> -There are currently three different object types: "blob", "tree" and
> -"commit".
> +the object (ie how it is used, and how it can refer to other objects).
> +There are currently four different object types: "blob", "tree",
> +"commit" and "tag".
You're reintroducing the "typos" fixed before, apparently.
> A "blob" object cannot refer to any other object, and is, like the tag
> implies, a pure storage object containing some user data. It is used to
> @@ -48,7 +50,7 @@
> directory structure. In addition, a tree object can refer to other tree
> objects, thus creating a directory hierarchy.
>
> -Finally, a "commit" object ties such directory hierarchies together into
> +A "commit" object ties such directory hierarchies together into
> a DAG of revisions - each "commit" is associated with exactly one tree
> (the directory hierarchy at the time of the commit). In addition, a
> "commit" refers to one or more "parent" commit objects that describe the
> @@ -62,12 +64,17 @@
> just going to confuse people. So aim for the notion of "one root object
> per project", even if git itself does not enforce that.
>
> +A "tag" object symbolically identifies and can be used to sign other
> +objects. It contains the identifier and type of another object, a
> +symbolic name (of course!) and, optionally, a signature.
> +
I think those changes should be either sent as a separate patch or noted
as being done in the commit message.
> @@ -245,216 +274,209 @@
>
>
>
> - The Workflow
> -
> -
> +The Workflow
> +------------
Cannot at least the newlines be preserved?
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* Re: [PATCH] [RFD] Add repoid identifier to commit [its a workspace id, isn't it?]
From: H. Peter Anvin @ 2005-05-13 22:26 UTC (permalink / raw)
To: Petr Baudis; +Cc: Jon Seymour, tglx, git
In-Reply-To: <20050513222502.GD32232@pasky.ji.cz>
Petr Baudis wrote:
>
> Why not just call the thing "branch"? It's as well eligible for that
> term as anything. :-)
>
Because cogito already calls too many things "branches"?
-hpa
^ permalink raw reply
* Re: [PATCH] [RFD] Add repoid identifier to commit [its a workspace id, isn't it?]
From: Petr Baudis @ 2005-05-13 22:25 UTC (permalink / raw)
To: Jon Seymour; +Cc: H. Peter Anvin, tglx, git
In-Reply-To: <2cfc4032050512183788e01fc@mail.gmail.com>
Dear diary, on Fri, May 13, 2005 at 03:37:47AM CEST, I got a letter
where Jon Seymour <jon.seymour@gmail.com> told me that...
> >
> > I would like to suggest a few limiters are set on the repoid. In
> > particular, I'd like to suggest that a repoid is a UUID, that a file is
> > used to track it (.git/repoid), and that if it doesn't exist, a new one
> > is created from /dev/urandom.
> >
>
> I think I understand what Thomas is trying to achieve, but I think
> there is a naming problem here. The marker really isn't a repoid - it
> is a workspace id.
Why not just call the thing "branch"? It's as well eligible for that
term as anything. :-)
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox