List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH 1/1] Display repository urls even if repository is empty
@ 2014-04-19 16:05 tobiasdreher
  2014-05-04 19:29 ` tobiasdreher
  2014-12-26 22:38 ` Jason
  0 siblings, 2 replies; 3+ messages in thread
From: tobiasdreher @ 2014-04-19 16:05 UTC (permalink / raw)


Hello everyone,

Currently cgit only outputs the line "Repository seems to be empty" if a 
repository is empty. However, this is often the case when you just 
created a bare new repository, and want to make your first commit, and 
for that you want to know the URL of your repository! This patch adds 
that output.



  cgit.c       |  5 +++--
  ui-summary.c | 20 ++++++++++++++++----
  ui-summary.h |  1 +
  3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/cgit.c b/cgit.c
index f488ebf..93a77a1 100644
--- a/cgit.c
+++ b/cgit.c
@@ -574,12 +574,15 @@ static int prepare_repo_cmd(void)
  		ctx.qry.nohead = 1;
  		ctx.qry.head = find_default_branch(ctx.repo);
  	}
+	sort_string_list(&ctx.repo->submodules);
+	cgit_prepare_repo_env(ctx.repo);

  	if (!ctx.qry.head) {
  		cgit_print_http_headers();
  		cgit_print_docstart();
  		cgit_print_pageheader();
  		cgit_print_error("Repository seems to be empty");
+		cgit_print_repository_urls_as_table();
  		cgit_print_docend();
  		return 1;
  	}
@@ -597,8 +600,6 @@ static int prepare_repo_cmd(void)
  		free(tmp);
  		return 1;
  	}
-	sort_string_list(&ctx.repo->submodules);
-	cgit_prepare_repo_env(ctx.repo);
  	choose_readme(ctx.repo);
  	return 0;
  }
diff --git a/ui-summary.c b/ui-summary.c
index df99ce1..c55ad62 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -70,6 +70,21 @@ static void print_urls(char *txt, char *suffix)
  	}
  }

+void cgit_print_repository_urls()
+{
+	if (ctx.repo->clone_url)
+		print_urls(expand_macros(ctx.repo->clone_url), NULL);
+	else if (ctx.cfg.clone_prefix)
+		print_urls(ctx.cfg.clone_prefix, ctx.repo->url);
+}
+
+void cgit_print_repository_urls_as_table()
+{
+	html("<table summary='repository info' class='list nowrap'>");
+	cgit_print_repository_urls();
+	html("</table>");
+}
+
  void cgit_print_summary()
  {
  	int columns = 3;
@@ -88,10 +103,7 @@ void cgit_print_summary()
  		cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL,
  			       NULL, NULL, 0, 0, 0);
  	}
-	if (ctx.repo->clone_url)
-		print_urls(expand_macros(ctx.repo->clone_url), NULL);
-	else if (ctx.cfg.clone_prefix)
-		print_urls(ctx.cfg.clone_prefix, ctx.repo->url);
+	cgit_print_repository_urls();
  	html("</table>");
  }

diff --git a/ui-summary.h b/ui-summary.h
index c01f560..1dd7e9e 100644
--- a/ui-summary.h
+++ b/ui-summary.h
@@ -1,6 +1,7 @@
  #ifndef UI_SUMMARY_H
  #define UI_SUMMARY_H

+extern void cgit_print_repository_urls_as_table();
  extern void cgit_print_summary();
  extern void cgit_print_repo_readme(char *path);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] Display repository urls even if repository is empty
  2014-04-19 16:05 [PATCH 1/1] Display repository urls even if repository is empty tobiasdreher
@ 2014-05-04 19:29 ` tobiasdreher
  2014-12-26 22:38 ` Jason
  1 sibling, 0 replies; 3+ messages in thread
From: tobiasdreher @ 2014-05-04 19:29 UTC (permalink / raw)


If I may ask: Could the patch be merged with master? I used my patch 
without a hitch here for the last weeks and as I said, it doesn't bring 
any changes for non-empty repositories.

On 2014-04-19 18:05, Tobias Dreher wrote:
> Hello everyone,
>
> Currently cgit only outputs the line "Repository seems to be empty" if a
> repository is empty. However, this is often the case when you just
> created a bare new repository, and want to make your first commit, and
> for that you want to know the URL of your repository! This patch adds
> that output.
>
>
>
>   cgit.c       |  5 +++--
>   ui-summary.c | 20 ++++++++++++++++----
>   ui-summary.h |  1 +
>   3 files changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/cgit.c b/cgit.c
> index f488ebf..93a77a1 100644
> --- a/cgit.c
> +++ b/cgit.c
> @@ -574,12 +574,15 @@ static int prepare_repo_cmd(void)
>           ctx.qry.nohead = 1;
>           ctx.qry.head = find_default_branch(ctx.repo);
>       }
> +    sort_string_list(&ctx.repo->submodules);
> +    cgit_prepare_repo_env(ctx.repo);
>
>       if (!ctx.qry.head) {
>           cgit_print_http_headers();
>           cgit_print_docstart();
>           cgit_print_pageheader();
>           cgit_print_error("Repository seems to be empty");
> +        cgit_print_repository_urls_as_table();
>           cgit_print_docend();
>           return 1;
>       }
> @@ -597,8 +600,6 @@ static int prepare_repo_cmd(void)
>           free(tmp);
>           return 1;
>       }
> -    sort_string_list(&ctx.repo->submodules);
> -    cgit_prepare_repo_env(ctx.repo);
>       choose_readme(ctx.repo);
>       return 0;
>   }
> diff --git a/ui-summary.c b/ui-summary.c
> index df99ce1..c55ad62 100644
> --- a/ui-summary.c
> +++ b/ui-summary.c
> @@ -70,6 +70,21 @@ static void print_urls(char *txt, char *suffix)
>       }
>   }
>
> +void cgit_print_repository_urls()
> +{
> +    if (ctx.repo->clone_url)
> +        print_urls(expand_macros(ctx.repo->clone_url), NULL);
> +    else if (ctx.cfg.clone_prefix)
> +        print_urls(ctx.cfg.clone_prefix, ctx.repo->url);
> +}
> +
> +void cgit_print_repository_urls_as_table()
> +{
> +    html("<table summary='repository info' class='list nowrap'>");
> +    cgit_print_repository_urls();
> +    html("</table>");
> +}
> +
>   void cgit_print_summary()
>   {
>       int columns = 3;
> @@ -88,10 +103,7 @@ void cgit_print_summary()
>           cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL,
>                      NULL, NULL, 0, 0, 0);
>       }
> -    if (ctx.repo->clone_url)
> -        print_urls(expand_macros(ctx.repo->clone_url), NULL);
> -    else if (ctx.cfg.clone_prefix)
> -        print_urls(ctx.cfg.clone_prefix, ctx.repo->url);
> +    cgit_print_repository_urls();
>       html("</table>");
>   }
>
> diff --git a/ui-summary.h b/ui-summary.h
> index c01f560..1dd7e9e 100644
> --- a/ui-summary.h
> +++ b/ui-summary.h
> @@ -1,6 +1,7 @@
>   #ifndef UI_SUMMARY_H
>   #define UI_SUMMARY_H
>
> +extern void cgit_print_repository_urls_as_table();
>   extern void cgit_print_summary();
>   extern void cgit_print_repo_readme(char *path);
> _______________________________________________
> CGit mailing list
> CGit at lists.zx2c4.com
> http://lists.zx2c4.com/mailman/listinfo/cgit


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] Display repository urls even if repository is empty
  2014-04-19 16:05 [PATCH 1/1] Display repository urls even if repository is empty tobiasdreher
  2014-05-04 19:29 ` tobiasdreher
@ 2014-12-26 22:38 ` Jason
  1 sibling, 0 replies; 3+ messages in thread
From: Jason @ 2014-12-26 22:38 UTC (permalink / raw)


Hey Tobias,

Sorry for the delay on this. Would you mind rebasing it on master, and
resubmitting? I'll merge it ASAP.

Thanks,
Jason

On Sat, Apr 19, 2014 at 6:05 PM, Tobias Dreher <tobiasdreher at outlook.com>
wrote:

> Hello everyone,
>
> Currently cgit only outputs the line "Repository seems to be empty" if a
> repository is empty. However, this is often the case when you just created
> a bare new repository, and want to make your first commit, and for that you
> want to know the URL of your repository! This patch adds that output.
>
>
>
>  cgit.c       |  5 +++--
>  ui-summary.c | 20 ++++++++++++++++----
>  ui-summary.h |  1 +
>  3 files changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/cgit.c b/cgit.c
> index f488ebf..93a77a1 100644
> --- a/cgit.c
> +++ b/cgit.c
> @@ -574,12 +574,15 @@ static int prepare_repo_cmd(void)
>                 ctx.qry.nohead = 1;
>                 ctx.qry.head = find_default_branch(ctx.repo);
>         }
> +       sort_string_list(&ctx.repo->submodules);
> +       cgit_prepare_repo_env(ctx.repo);
>
>         if (!ctx.qry.head) {
>                 cgit_print_http_headers();
>                 cgit_print_docstart();
>                 cgit_print_pageheader();
>                 cgit_print_error("Repository seems to be empty");
> +               cgit_print_repository_urls_as_table();
>                 cgit_print_docend();
>                 return 1;
>         }
> @@ -597,8 +600,6 @@ static int prepare_repo_cmd(void)
>                 free(tmp);
>                 return 1;
>         }
> -       sort_string_list(&ctx.repo->submodules);
> -       cgit_prepare_repo_env(ctx.repo);
>         choose_readme(ctx.repo);
>         return 0;
>  }
> diff --git a/ui-summary.c b/ui-summary.c
> index df99ce1..c55ad62 100644
> --- a/ui-summary.c
> +++ b/ui-summary.c
> @@ -70,6 +70,21 @@ static void print_urls(char *txt, char *suffix)
>         }
>  }
>
> +void cgit_print_repository_urls()
> +{
> +       if (ctx.repo->clone_url)
> +               print_urls(expand_macros(ctx.repo->clone_url), NULL);
> +       else if (ctx.cfg.clone_prefix)
> +               print_urls(ctx.cfg.clone_prefix, ctx.repo->url);
> +}
> +
> +void cgit_print_repository_urls_as_table()
> +{
> +       html("<table summary='repository info' class='list nowrap'>");
> +       cgit_print_repository_urls();
> +       html("</table>");
> +}
> +
>  void cgit_print_summary()
>  {
>         int columns = 3;
> @@ -88,10 +103,7 @@ void cgit_print_summary()
>                 cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL,
>                                NULL, NULL, 0, 0, 0);
>         }
> -       if (ctx.repo->clone_url)
> -               print_urls(expand_macros(ctx.repo->clone_url), NULL);
> -       else if (ctx.cfg.clone_prefix)
> -               print_urls(ctx.cfg.clone_prefix, ctx.repo->url);
> +       cgit_print_repository_urls();
>         html("</table>");
>  }
>
> diff --git a/ui-summary.h b/ui-summary.h
> index c01f560..1dd7e9e 100644
> --- a/ui-summary.h
> +++ b/ui-summary.h
> @@ -1,6 +1,7 @@
>  #ifndef UI_SUMMARY_H
>  #define UI_SUMMARY_H
>
> +extern void cgit_print_repository_urls_as_table();
>  extern void cgit_print_summary();
>  extern void cgit_print_repo_readme(char *path);
> _______________________________________________
> CGit mailing list
> CGit at lists.zx2c4.com
> http://lists.zx2c4.com/mailman/listinfo/cgit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20141226/777c168b/attachment.html>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-26 22:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-19 16:05 [PATCH 1/1] Display repository urls even if repository is empty tobiasdreher
2014-05-04 19:29 ` tobiasdreher
2014-12-26 22:38 ` Jason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).