From 75c84ddb468a87006eaaa894cccf1a279a579406 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Mon, 19 Jun 2006 20:27:59 +0200 Subject: Make CSS file gitweb/gitweb.css more readable Taken from git://git.xmms.se/xmms2/gitweb-xmms2.git commit 561262030d58a6325f500b36d836dbe02a5abc68 "Make CSS readable" by Daniel Svensson, with extra parts removed and consistent whitespace usage. [jc: tabified the results to cleaning things up, and removed an added item that was commented out. ] Signed-off-by: Junio C Hamano --- gitweb/gitweb.css | 272 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 222 insertions(+), 50 deletions(-) diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css index bf95e3849..4378067d3 100644 --- a/gitweb/gitweb.css +++ b/gitweb/gitweb.css @@ -1,58 +1,230 @@ body { - font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; - margin:10px; background-color:#ffffff; color:#000000; -} -a { color:#0000cc; } -a:hover, a:visited, a:active { color:#880000; } -div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; } -div.page_header a:visited, a.header { color:#0000cc; } -div.page_header a:hover { color:#880000; } -div.page_nav { padding:8px; } -div.page_nav a:visited { color:#0000cc; } -div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px} -div.page_footer { height:17px; padding:4px 8px; background-color: #d9d8d1; } -div.page_footer_text { float:left; color:#555555; font-style:italic; } -div.page_body { padding:8px; } + font-family: sans-serif; + font-size: 12px; + border:solid #d9d8d1; + border-width: 1px; + margin: 10px; + background-color: #ffffff; + color: #000000; +} + +a { + color: #0000cc; +} + +a:hover, a:visited, a:active { + color: #880000; +} + +div.page_header { + height: 25px; + padding: 8px; + font-size: 18px; + font-weight: bold; + background-color: #d9d8d1; +} + +div.page_header a:visited, a.header { + color: #0000cc; +} + +div.page_header a:hover { + color: #880000; +} + +div.page_nav { + padding:8px; +} + +div.page_nav a:visited { + color: #0000cc; +} + +div.page_path { + padding: 8px; + border: solid #d9d8d1; + border-width: 0px 0px 1px; +} + +div.page_footer { + height: 17px; + padding: 4px 8px; + background-color: #d9d8d1; +} + +div.page_footer_text { + float: left; + color: #555555; + font-style: italic; +} + +div.page_body { + padding: 8px; +} + div.title, a.title { - display:block; padding:6px 8px; - font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000; + display: block; + padding: 6px 8px; + font-weight: bold; + background-color: #edece6; + text-decoration: none; + color: #000000; +} + +a.title:hover { + background-color: #d9d8d1; +} + +div.title_text { + padding: 6px 0px; + border: solid #d9d8d1; + border-width: 0px 0px 1px; } -a.title:hover { background-color: #d9d8d1; } -div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; } -div.log_body { padding:8px 8px 8px 150px; } -span.age { position:relative; float:left; width:142px; font-style:italic; } + +div.log_body { + padding: 8px 8px 8px 150px; +} + +span.age { + position: relative; + float: left; + width: 142px; + font-style:italic; +} + div.log_link { - padding:0px 8px; - font-size:10px; font-family:sans-serif; font-style:normal; - position:relative; float:left; width:136px; -} -div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; } -a.list { text-decoration:none; color:#000000; } -a.list:hover { text-decoration:underline; color:#880000; } -a.text { text-decoration:none; color:#0000cc; } -a.text:visited { text-decoration:none; color:#880000; } -a.text:hover { text-decoration:underline; color:#880000; } -table { padding:8px 4px; } -th { padding:2px 5px; font-size:12px; text-align:left; } -tr.light:hover { background-color:#edece6; } -tr.dark { background-color:#f6f6f0; } -tr.dark:hover { background-color:#edece6; } -td { padding:2px 5px; font-size:12px; vertical-align:top; } -td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; } -div.pre { font-family:monospace; font-size:12px; white-space:pre; } -div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; } -div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; } -div.search { margin:4px 8px; position:absolute; top:56px; right:12px } -a.linenr { color:#999999; text-decoration:none } + padding: 0px 8px; + font-size: 10px; + font-family: sans-serif; + font-style:normal; + position: relative; + float: left; + width: 136px; +} + +div.list_head { + padding: 6px 8px 4px; + border: solid #d9d8d1; + border-width: 1px 0px 0px; + font-style: italic; +} + +a.list { + text-decoration: none; + color: #000000; +} + +a.list:hover { + text-decoration: underline; + color: #880000; +} + +a.text { + text-decoration: none; + color: #0000cc; +} + +a.text:visited { + text-decoration: none; + color: #880000; +} + +a.text:hover { + text-decoration: underline; + color: #880000; +} + +table { + padding: 8px 4px; +} + +th { + padding: 2px 5px; + font-size: 12px; + text-align: left; +} + +tr.light:hover { + background-color: #edece6; +} + +tr.dark { + background-color: #f6f6f0; +} + +tr.dark:hover { + background-color: #edece6; +} + + +td { + padding: 2px 5px; + font-size: 12px; + vertical-align:top; +} + +td.link { + padding: 2px 5px; + font-family: sans-serif; + font-size: 10px; +} + +div.pre { + font-family: monospace; + font-size: 12px; + white-space: pre; +} + +div.diff_info { + font-family: monospace; + color: #000099; + background-color: #edece6; + font-style: italic; +} + +div.index_include { + border: solid #d9d8d1; + border-width: 0px 0px 1px; + padding: 12px 8px; +} + +div.search { + margin: 4px 8px; + position: absolute; + top: 56px; + right: 12px +} + +a.linenr { + color: #999999; + text-decoration: none +} + a.rss_logo { - float:right; padding:3px 0px; width:35px; line-height:10px; - border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e; - color:#ffffff; background-color:#ff6600; - font-weight:bold; font-family:sans-serif; font-size:10px; - text-align:center; text-decoration:none; + float: right; + padding: 3px 0px; + width: 35px; + line-height: 10px; + border: 1px solid; + border-color: #fcc7a5 #7d3302 #3e1a01 #ff954e; + color: #ffffff; + background-color: #ff6600; + font-weight: bold; + font-family: sans-serif; + font-size: 10px; + text-align: center; + text-decoration: none; +} + +a.rss_logo:hover { + background-color: #ee5500; } -a.rss_logo:hover { background-color:#ee5500; } + span.tag { - padding:0px 4px; font-size:10px; font-weight:normal; - background-color:#ffffaa; border:1px solid; border-color:#ffffcc #ffee00 #ffee00 #ffffcc; + padding: 0px 4px; + font-size: 10px; + font-weight: normal; + background-color: #ffffaa; + border: 1px solid; + border-color: #ffffcc #ffee00 #ffee00 #ffffcc; } -- cgit v1.2.1 From 928e47e3d50527adcfef20932f3b2764b9f11f06 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 20 Jun 2006 00:55:20 +0200 Subject: Initialize lock_file struct to all zero. hold_lock_file_for_update() relies on that. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- builtin-update-index.c | 2 +- builtin-write-tree.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin-update-index.c b/builtin-update-index.c index 325cd0944..ef5024345 100644 --- a/builtin-update-index.c +++ b/builtin-update-index.c @@ -490,7 +490,7 @@ int cmd_update_index(int argc, const char **argv, char **envp) git_config(git_default_config); /* We can't free this memory, it becomes part of a linked list parsed atexit() */ - lock_file = xmalloc(sizeof(struct lock_file)); + lock_file = xcalloc(1, sizeof(struct lock_file)); newfd = hold_lock_file_for_update(lock_file, get_index_file()); if (newfd < 0) diff --git a/builtin-write-tree.c b/builtin-write-tree.c index c3aac3602..70e9b6fcc 100644 --- a/builtin-write-tree.c +++ b/builtin-write-tree.c @@ -16,7 +16,7 @@ int write_tree(unsigned char *sha1, int missing_ok, const char *prefix) int entries, was_valid, newfd; /* We can't free this memory, it becomes part of a linked list parsed atexit() */ - struct lock_file *lock_file = xmalloc(sizeof(struct lock_file)); + struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file)); newfd = hold_lock_file_for_update(lock_file, get_index_file()); -- cgit v1.2.1 From 9c3796fc0474ac6fc77da4886a246a37a7fbe856 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 20 Jun 2006 00:51:58 +0200 Subject: Fix setting config variables with an alternative GIT_CONFIG When setting a config variable, git_config_set() ignored the variables GIT_CONFIG and GIT_CONFIG_LOCAL. Now, when GIT_CONFIG_LOCAL is set, it will write to that file. If not, GIT_CONFIG is checked, and only as a fallback, the change is written to $GIT_DIR/config. Add a test for it, and also future-proof the test for the upcoming $HOME/.gitconfig support. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- config.c | 15 ++++++++++++--- t/Makefile | 2 +- t/t1300-repo-config.sh | 24 ++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/config.c b/config.c index d46eb6d82..37862d429 100644 --- a/config.c +++ b/config.c @@ -500,10 +500,19 @@ int git_config_set_multivar(const char* key, const char* value, int i, dot; int fd = -1, in_fd; int ret; - char* config_filename = strdup(git_path("config")); - char* lock_file = strdup(git_path("config.lock")); + char* config_filename; + char* lock_file; const char* last_dot = strrchr(key, '.'); + config_filename = getenv("GIT_CONFIG"); + if (!config_filename) { + config_filename = getenv("GIT_CONFIG_LOCAL"); + if (!config_filename) + config_filename = git_path("config"); + } + config_filename = strdup(config_filename); + lock_file = strdup(mkpath("%s.lock", config_filename)); + /* * Since "key" actually contains the section name and the real * key name separated by a dot, we have to know where the dot is. @@ -610,7 +619,7 @@ int git_config_set_multivar(const char* key, const char* value, * As a side effect, we make sure to transform only a valid * existing config file. */ - if (git_config(store_aux)) { + if (git_config_from_file(store_aux, config_filename)) { fprintf(stderr, "invalid config file\n"); free(store.key); if (store.value_regex != NULL) { diff --git a/t/Makefile b/t/Makefile index 549598575..632c55f6d 100644 --- a/t/Makefile +++ b/t/Makefile @@ -19,7 +19,7 @@ endif all: $(T) clean $(T): - @echo "*** $@ ***"; '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS) + @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS) clean: rm -fr trash diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 8260d57b6..0de249774 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -309,5 +309,29 @@ EOF test_expect_success 'new variable inserts into proper section' 'cmp .git/config expect' +cat > other-config << EOF +[ein] + bahn = strasse +EOF + +cat > expect << EOF +ein.bahn=strasse +EOF + +GIT_CONFIG=other-config git-repo-config -l > output + +test_expect_success 'alternative GIT_CONFIG' 'cmp output expect' + +GIT_CONFIG=other-config git-repo-config anwohner.park ausweis + +cat > expect << EOF +[ein] + bahn = strasse +[anwohner] + park = ausweis +EOF + +test_expect_success '--set in alternative GIT_CONFIG' 'cmp other-config expect' + test_done -- cgit v1.2.1 From 5f1a63e0efc750c54a25644a36cf2905495a9b93 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 20 Jun 2006 01:48:03 +0200 Subject: Read configuration also from $HOME/.gitconfig This patch is based on Pasky's, with three notable differences: - I did not yet update the documentation - I named it .gitconfig, not .gitrc - git-repo-config does not barf when a unique key is overridden locally The last means that if you have something like [alias] l = log --stat -M in ~/.gitconfig, and [alias] l = log --stat -M next.. in $GIT_DIR/config, then git-repo-config alias.l returns only one value, namely the value from $GIT_DIR/config. If you set the environment variable GIT_CONFIG, $HOME/.gitconfig is not read, and neither $GIT_DIR/config, but $GIT_CONFIG instead. If you set GIT_CONFIG_LOCAL instead, it is interpreted instead of $GIT_DIR/config, but $HOME/.gitconfig is still read. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- config.c | 34 +++++++++++++++++++++++++--------- repo-config.c | 39 +++++++++++++++++++++++++++++++++------ 2 files changed, 58 insertions(+), 15 deletions(-) diff --git a/config.c b/config.c index 37862d429..d064f429c 100644 --- a/config.c +++ b/config.c @@ -317,17 +317,33 @@ int git_config_from_file(config_fn_t fn, const char *filename) int git_config(config_fn_t fn) { - const char *filename = git_path("config"); - /* Forward-compatibility cue: $GIT_CONFIG makes git read _only_ - * the given config file, $GIT_CONFIG_LOCAL will make it process - * it in addition to the global config file, the same way it would - * the per-repository config file otherwise. */ - if (getenv("GIT_CONFIG")) { - filename = getenv("GIT_CONFIG"); - } else if (getenv("GIT_CONFIG_LOCAL")) { + int ret = 0; + char *repo_config = NULL; + const char *home = NULL, *filename; + + /* $GIT_CONFIG makes git read _only_ the given config file, + * $GIT_CONFIG_LOCAL will make it process it in addition to the + * global config file, the same way it would the per-repository + * config file otherwise. */ + filename = getenv("GIT_CONFIG"); + if (!filename) { + home = getenv("HOME"); filename = getenv("GIT_CONFIG_LOCAL"); + if (!filename) + filename = repo_config = strdup(git_path("config")); } - return git_config_from_file(fn, filename); + + if (home) { + char *user_config = strdup(mkpath("%s/.gitconfig", home)); + if (access(user_config, R_OK) > 0) + ret = git_config_from_file(fn, user_config); + free(user_config); + } + + ret += git_config_from_file(fn, filename); + if (repo_config) + free(repo_config); + return ret; } /* diff --git a/repo-config.c b/repo-config.c index 08fc4cc57..03f108fe2 100644 --- a/repo-config.c +++ b/repo-config.c @@ -64,7 +64,22 @@ static int show_config(const char* key_, const char* value_) static int get_value(const char* key_, const char* regex_) { + int ret = -1; char *tl; + char *global = NULL, *repo_config = NULL; + const char *local; + + local = getenv("GIT_CONFIG"); + if (!local) { + const char *home = getenv("HOME"); + local = getenv("GIT_CONFIG_LOCAL"); + if (!local) + local = repo_config; + else + local = repo_config = strdup(git_path("config")); + if (home) + global = strdup(mkpath("%s/.gitconfig", home)); + } key = strdup(key_); for (tl=key+strlen(key)-1; tl >= key && *tl != '.'; --tl) @@ -76,7 +91,7 @@ static int get_value(const char* key_, const char* regex_) key_regexp = (regex_t*)malloc(sizeof(regex_t)); if (regcomp(key_regexp, key, REG_EXTENDED)) { fprintf(stderr, "Invalid key pattern: %s\n", key_); - return -1; + goto free_strings; } } @@ -89,11 +104,16 @@ static int get_value(const char* key_, const char* regex_) regexp = (regex_t*)malloc(sizeof(regex_t)); if (regcomp(regexp, regex_, REG_EXTENDED)) { fprintf(stderr, "Invalid pattern: %s\n", regex_); - return -1; + goto free_strings; } } - git_config(show_config); + if (do_all && global) + git_config_from_file(show_config, global); + git_config_from_file(show_config, local); + if (!do_all && !seen && global) + git_config_from_file(show_config, global); + free(key); if (regexp) { regfree(regexp); @@ -101,9 +121,16 @@ static int get_value(const char* key_, const char* regex_) } if (do_all) - return !seen; - - return (seen == 1) ? 0 : 1; + ret = !seen; + else + ret = (seen == 1) ? 0 : 1; + +free_strings: + if (repo_config) + free(repo_config); + if (global) + free(global); + return ret; } int main(int argc, const char **argv) -- cgit v1.2.1