[gnome-builder/wip/gtk4-port] plugins/git: wrap to IdeVcsUri for directory name



commit 3dbd441227d258c4cf6402ac837c428694e4560e
Author: Christian Hergert <chergert redhat com>
Date:   Tue May 31 23:14:26 2022 -0700

    plugins/git: wrap to IdeVcsUri for directory name
    
    It already does the hard work, we can just use it. Layer violations and
    all.

 src/plugins/git/gbp-git-vcs-cloner.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
---
diff --git a/src/plugins/git/gbp-git-vcs-cloner.c b/src/plugins/git/gbp-git-vcs-cloner.c
index 60f25d721..4ff950773 100644
--- a/src/plugins/git/gbp-git-vcs-cloner.c
+++ b/src/plugins/git/gbp-git-vcs-cloner.c
@@ -521,24 +521,10 @@ static char *
 gbp_git_vcs_cloner_get_directory_name (IdeVcsCloner *cloner,
                                        IdeVcsUri    *uri)
 {
-  g_autofree char *name = NULL;
-  const char *path;
-  char *dot;
-
   g_assert (GBP_IS_GIT_VCS_CLONER (cloner));
   g_assert (uri != NULL);
 
-  /* Make sure we have a path to use as a name */
-  path = ide_vcs_uri_get_path (uri);
-  if (ide_str_empty0 (path))
-    return NULL;
-
-  /* Remove trailing .git if necessary */
-  name = g_path_get_basename (path);
-  if ((dot = strrchr (name, '.')) && ide_str_equal0 (dot, ".git"))
-    *dot = 0;
-
-  return g_steal_pointer (&name);
+  return ide_vcs_uri_get_clone_name (uri);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]